;
ثق"Ic               @   s@   d  Z  d   Z d   Z d d  Z e d k o e   n d S(   u%  This module includes tests of the code object representation.

>>> def f(x):
...     def g(y):
...         return x + y
...     return g
...

>>> dump(f.__code__)
name: f
argcount: 1
kwonlyargcount: 0
names: ()
varnames: ('x', 'g')
cellvars: ('x',)
freevars: ()
nlocals: 2
flags: 3
consts: ('None', '<code object g>')

>>> dump(f(4).__code__)
name: g
argcount: 1
kwonlyargcount: 0
names: ()
varnames: ('y',)
cellvars: ()
freevars: ('x',)
nlocals: 1
flags: 19
consts: ('None',)

>>> def h(x, y):
...     a = x + y
...     b = x - y
...     c = a * b
...     return c
...

>>> dump(h.__code__)
name: h
argcount: 2
kwonlyargcount: 0
names: ()
varnames: ('x', 'y', 'a', 'b', 'c')
cellvars: ()
freevars: ()
nlocals: 5
flags: 67
consts: ('None',)

>>> def attrs(obj):
...     print(obj.attr1)
...     print(obj.attr2)
...     print(obj.attr3)

>>> dump(attrs.__code__)
name: attrs
argcount: 1
kwonlyargcount: 0
names: ('print', 'attr1', 'attr2', 'attr3')
varnames: ('obj',)
cellvars: ()
freevars: ()
nlocals: 1
flags: 67
consts: ('None',)

>>> def optimize_away():
...     'doc string'
...     'not a docstring'
...     53
...     0x53

>>> dump(optimize_away.__code__)
name: optimize_away
argcount: 0
kwonlyargcount: 0
names: ()
varnames: ()
cellvars: ()
freevars: ()
nlocals: 0
flags: 67
consts: ("'doc string'", 'None')

>>> def keywordonly_args(a,b,*,k1):
...     return a,b,k1
...

>>> dump(keywordonly_args.__code__)
name: keywordonly_args
argcount: 2
kwonlyargcount: 1
names: ()
varnames: ('a', 'b', 'k1')
cellvars: ()
freevars: ()
nlocals: 3
flags: 67
consts: ('None',)

c             c   sF   x? |  D]7 } t  |  } | j d  o d | j Vq | Vq Wd S(   u.   Yield a doctest-safe sequence of object reprs.u   <code objectu   <code object %s>N(   u   repru
   startswithu   co_name(   u   tu   eltu   r(    (    u+   /mit/python/lib/python3.0/test/test_code.pyu   constsi   s     c          	   C   sm   xJ d d d d d d d d d	 g	 D]' } t  d
 | t |  d |  f  q" Wt  d t t |  j    d S(   u1   Print out a text representation of a code object.u   nameu   argcountu   kwonlyargcountu   namesu   varnamesu   cellvarsu   freevarsu   nlocalsu   flagsu   %s: %su   co_u   consts:N(   u   printu   getattru   tupleu   constsu	   co_consts(   u   cou   attr(    (    u+   /mit/python/lib/python3.0/test/test_code.pyu   dumpr   s
     %c             C   s1   d d l  m } d d l m } | | |   d  S(   Ni    (   u   run_doctest(   u	   test_code(   u   test.supportu   run_doctestu   testu	   test_code(   u   verboseu   run_doctestu	   test_code(    (    u+   /mit/python/lib/python3.0/test/test_code.pyu	   test_mainy   s    u   __main__N(   u   __doc__u   constsu   dumpu   Noneu	   test_mainu   __name__(    (    (    u+   /mit/python/lib/python3.0/test/test_code.pyu   <module>g   s
   			