Ñò
‘à"Ic           @   s˜   d  d k  Z  d  d k l Z l Z d  d k Z e i d d e d ƒ e i d d e d ƒ d e  i f d „  ƒ  YZ d	 „  Z	 e
 d
 j o e	 ƒ  n d S(   iÿÿÿÿN(   t   check_syntax_errort   run_unittestt   ignores	   import \*s   <test string>s   <string>t
   ScopeTestsc           B   sò   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d	 „  Z d
 „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   sQ   d „  } | d ƒ } | d ƒ } |  i  | d ƒ d ƒ |  i  | d ƒ d ƒ d  S(   Nc            s   ‡  f d †  } | S(   Nc            s   ˆ  |  S(   N(    (   t   y(   t   x(    s,   /mit/python/lib/python2.6/test/test_scope.pyt   adder   s    (    (   R   R   (    (   R   s,   /mit/python/lib/python2.6/test/test_scope.pyt
   make_adder   s    i   i
   i   iþÿÿÿi   (   t   assertEqual(   t   selfR   t   inct   plus10(    (    s,   /mit/python/lib/python2.6/test/test_scope.pyt   testSimpleNesting
   s
    	c         C   sQ   d „  } | d ƒ } | d ƒ } |  i  | d ƒ d ƒ |  i  | d ƒ d ƒ d  S(   Nc            s   ‡  f d †  } | ƒ  S(   Nc             s   ‡  f d †  }  |  S(   Nc            s   ˆ  |  S(   N(    (   R   (   R   (    s,   /mit/python/lib/python2.6/test/test_scope.pyR      s    (    (   R   (   R   (    s,   /mit/python/lib/python2.6/test/test_scope.pyt   extra   s    (    (   R   R   (    (   R   s,   /mit/python/lib/python2.6/test/test_scope.pyt   make_adder2   s    i   i
   i   iþÿÿÿi   (   R   (   R	   R   R
   R   (    (    s,   /mit/python/lib/python2.6/test/test_scope.pyt   testExtraNesting   s
    	c         C   sQ   d „  } | d ƒ } | d ƒ } |  i  | d ƒ d ƒ |  i  | d ƒ d ƒ d  S(   Nc            s   ‡  f d †  } ˆ  d ‰  | S(   Nc            s   ˆ  |  S(   N(    (   R   (   R   (    s,   /mit/python/lib/python2.6/test/test_scope.pyR   )   s    i   (    (   R   R   (    (   R   s,   /mit/python/lib/python2.6/test/test_scope.pyt   make_adder3(   s    
i    i	   i   i   iþÿÿÿi   (   R   (   R	   R   R
   R   (    (    s,   /mit/python/lib/python2.6/test/test_scope.pyt   testSimpleAndRebinding&   s
    	c            sT   ‡  f d †  } d ‰  | ƒ  } |  i  | d ƒ d ƒ d ‰  |  i  | d ƒ d ƒ d  S(   Nc             s   ‡  f d †  }  |  ƒ  S(   Nc             s   ‡  f d †  }  |  ƒ  S(   Nc             s   ‡  f d †  }  |  S(   Nc            s   ˆ  |  S(   N(    (   R   (   t   global_x(    s,   /mit/python/lib/python2.6/test/test_scope.pyR   9   s    (    (   R   (   R   (    s,   /mit/python/lib/python2.6/test/test_scope.pyt   nest8   s    (    (   R   (   R   (    s,   /mit/python/lib/python2.6/test/test_scope.pyR   7   s    (    (   R   (   R   (    s,   /mit/python/lib/python2.6/test/test_scope.pyt   make_adder46   s    i   i   i
   iþÿÿÿi   (   R   (   R	   R   R   (    (   R   s,   /mit/python/lib/python2.6/test/test_scope.pyt   testNestingGlobalNoFree4   s    		c         C   sQ   d „  } | d ƒ } | d ƒ } |  i  | d ƒ d ƒ |  i  | d ƒ d ƒ d  S(   Nc            s    d d ‡  f d †  ƒ  Y} | ƒ  S(   Nt   Adderc              s   e  Z ‡  f d  †  Z RS(   c            s   ˆ  | S(   N(    (   R	   R   (   R   (    s,   /mit/python/lib/python2.6/test/test_scope.pyt   __call__J   s    (   t   __name__t
   __module__R   (    (   R   (    s,   /mit/python/lib/python2.6/test/test_scope.pyR   I   s   (    (    (   R   R   (    (   R   s,   /mit/python/lib/python2.6/test/test_scope.pyt   make_adder5H   s    i   i
   i   iþÿÿÿi   (   R   (   R	   R   R
   R   (    (    s,   /mit/python/lib/python2.6/test/test_scope.pyt   testNestingThroughClassF   s
    	c         C   sQ   d „  } | d ƒ } | d ƒ } |  i  | d ƒ d ƒ |  i  | d ƒ d ƒ d  S(   Nc         S   s   d „  } |  a  | S(   Nc         S   s   t  |  S(   N(   t   global_nest_x(   R   (    (    s,   /mit/python/lib/python2.6/test/test_scope.pyR   X   s    (   R   (   R   R   (    (    s,   /mit/python/lib/python2.6/test/test_scope.pyt   make_adder6V   s    	i   i
   i   iþÿÿÿi   (   R   (   R	   R   R
   R   (    (    s,   /mit/python/lib/python2.6/test/test_scope.pyt   testNestingPlusFreeRefToGlobalT   s
    	c         C   s/   d „  } | d ƒ } |  i  | d ƒ d ƒ d  S(   Nc         S   s   d „  } | d ƒ S(   Nc            s   d ‰  ‡  f d †  } | S(   Ni*   c            s   ˆ  |  S(   N(    (   t   z(   R   (    s,   /mit/python/lib/python2.6/test/test_scope.pyt   hh   s    (    (   R   R    (    (   R   s,   /mit/python/lib/python2.6/test/test_scope.pyt   gf   s    i   (    (   R   R!   (    (    s,   /mit/python/lib/python2.6/test/test_scope.pyt   fe   s    	i
   i   i/   (   R   (   R	   R"   t	   test_func(    (    s,   /mit/python/lib/python2.6/test/test_scope.pyt   testNearestEnclosingScopec   s    	c            sS   d „  ‰  ‡  f d †  } | d d d ƒ } | d d d ƒ } |  i  | ƒ  d ƒ d  S(	   Nc         S   s   |  S(   N(    (   R   (    (    s,   /mit/python/lib/python2.6/test/test_scope.pyt   identityr   s    c            s   ‡  ‡ ‡ f d †  } | S(   Nc            s0   |  ˆ }  ‡ ‡ ‡  ‡ f d †  } | ˆ ‰ | S(   Nc              s   ˆ ˆ ˆ ˆ  ƒ S(   N(    (    (   R   R   t   bR%   (    s,   /mit/python/lib/python2.6/test/test_scope.pyR    x   s    (    (   t   aR&   t   cR    (   R   R   R%   (   R&   R   s,   /mit/python/lib/python2.6/test/test_scope.pyR!   v   s    

(    (   R   R   R   R!   (   R%   (   R   R   s,   /mit/python/lib/python2.6/test/test_scope.pyR"   u   s    i   i   i   i   i   i'   (   R   (   R	   R"   R!   R    (    (   R%   s,   /mit/python/lib/python2.6/test/test_scope.pyt   testMixedFreevarsAndCellvarsp   s
    	c            sÂ   d „  } | ƒ  } |  i  | i ƒ  d ƒ |  i  | i ƒ  d ƒ |  i  | i ƒ  d ƒ d ‰  d d ‡  f d †  ƒ  Y} | ƒ  } |  i  | i ƒ  d ƒ |  i  | i ƒ  d ƒ |  i  | i ƒ  d ƒ d  S(   Nc             s&   d ‰  d d ‡  f d †  ƒ  Y}  |  ƒ  S(   Nt   vart   Testc              s2   e  Z d  „  Z ‡  f d †  Z d „  Z d „  Z RS(   c         S   s   d S(   Nt   method(    (   R	   (    (    s,   /mit/python/lib/python2.6/test/test_scope.pyt   method_and_var‰   s    c            s   ˆ  S(   N(    (   R	   (   R-   (    s,   /mit/python/lib/python2.6/test/test_scope.pyt   test‹   s    c         S   s
   t  d ƒ S(   Nt   global(   t   str(   R	   (    (    s,   /mit/python/lib/python2.6/test/test_scope.pyt   actual_global   s    c         S   s
   t  |  ƒ S(   N(   R0   (   R	   (    (    s,   /mit/python/lib/python2.6/test/test_scope.pyR0      s    (   R   R   R-   R.   R1   R0   (    (   R-   (    s,   /mit/python/lib/python2.6/test/test_scope.pyR+   ˆ   s   		(    (    (   R+   (    (   R-   s,   /mit/python/lib/python2.6/test/test_scope.pyR.   †   s    	R*   R,   R/   R+   c              s2   e  Z d  „  Z ‡  f d †  Z d „  Z d „  Z RS(   c         S   s   d S(   NR,   (    (   R	   (    (    s,   /mit/python/lib/python2.6/test/test_scope.pyR-   ›   s    c            s   ˆ  S(   N(    (   R	   (   R-   (    s,   /mit/python/lib/python2.6/test/test_scope.pyR.      s    c         S   s
   t  d ƒ S(   NR/   (   R0   (   R	   (    (    s,   /mit/python/lib/python2.6/test/test_scope.pyR1   Ÿ   s    c         S   s
   t  |  ƒ S(   N(   R0   (   R	   (    (    s,   /mit/python/lib/python2.6/test/test_scope.pyR0   ¡   s    (   R   R   R-   R.   R1   R0   (    (   R-   (    s,   /mit/python/lib/python2.6/test/test_scope.pyR+   ™   s   		(    (   R   R.   R-   R1   (   R	   R.   t   tR+   (    (   R-   s,   /mit/python/lib/python2.6/test/test_scope.pyt   testFreeVarInMethod„   s    			c         C   s#   d „  } |  i  | d ƒ d ƒ d  S(   Nc            s4   ‡  f d †  ‰  |  d j o ˆ  |  ƒ St  d ‚ d  S(   Nc            s(   |  d j o d S|  ˆ  |  d ƒ Sd  S(   Ni    i   (    (   t   n(   t   fact(    s,   /mit/python/lib/python2.6/test/test_scope.pyR5   ¬   s    i    s   x must be >= 0(   t
   ValueError(   R   (    (   R5   s,   /mit/python/lib/python2.6/test/test_scope.pyR"   «   s    i   iÐ  (   R   (   R	   R"   (    (    s,   /mit/python/lib/python2.6/test/test_scope.pyt   testRecursion©   s    	c         B   sZ   e  |  d ƒ e  |  d ƒ e  |  d ƒ e  |  d ƒ e  |  d ƒ e  |  d ƒ d d  Ud  S(   NsŠ   def unoptimized_clash1(strip):
    def f(s):
        from string import *
        return strip(s) # ambiguity: free or local
    return f
sƒ   def unoptimized_clash2():
    from string import *
    def f(s):
        return strip(s) # ambiguity: global or local
    return f
sœ   def unoptimized_clash2():
    from string import *
    def g():
        def f(s):
            return strip(s) # ambiguity: global or local
        return f
sO   def error(y):
    exec "a = 1"
    def f(x):
        return x + y
    return f
sC   def f(x):
    def g():
        return x
    del x # can't del name
s[   def f():
    def g():
        from string import *
        return strip # global or local?
sç   
def noproblem1():
    from string import *
    f = lambda x:x

def noproblem2():
    from string import *
    def f(x):
        return x + 1

def noproblem3():
    from string import *
    def f(x):
        global y
        y = x
(   R    (   R	   (    (    s,   /mit/python/lib/python2.6/test/test_scope.pyt   testUnoptimizedNamespaces¹   s    c   	         s  d „  } | d ƒ } | d ƒ } |  i  | d ƒ d ƒ |  i  | d ƒ d ƒ d „  } | d ƒ } | d ƒ } |  i  | d ƒ d ƒ |  i  | d ƒ d ƒ ‡  f d †  } d ‰  | d  ƒ } |  i  | d ƒ d	 ƒ d
 „  } | d d d	 ƒ } | d d d ƒ } |  i  | ƒ  d ƒ d  S(   Nc            s   ‡  f d  †  S(   c            s   ˆ  |  S(    (    (   R   (   R   (    s,   /mit/python/lib/python2.6/test/test_scope.pyt   <lambda>   s    (    (   R   (    (   R   s,   /mit/python/lib/python2.6/test/test_scope.pyR9      s    i   i
   i   i   i   c            s   ‡  f d  †  ƒ  S(   c              s   ‡  f d  †  S(   c            s   ˆ  |  S(    (    (   R   (   R   (    s,   /mit/python/lib/python2.6/test/test_scope.pyR9     s    (    (    (   R   (    s,   /mit/python/lib/python2.6/test/test_scope.pyR9     s    (    (   R   (    (   R   s,   /mit/python/lib/python2.6/test/test_scope.pyR9     s    c            s   ‡  f d  †  S(   c            s   ˆ  |  S(    (    (   R   (   R   (    s,   /mit/python/lib/python2.6/test/test_scope.pyR9     s    (    (   R   (   R   (    s,   /mit/python/lib/python2.6/test/test_scope.pyR9     s    i   c            s   ‡  ‡ f d  †  S(   c            s   ‡ ‡ ‡  f d  †  S(   c              s   ˆ ˆ ˆ  S(    (    (    (   R   R   R&   (    s,   /mit/python/lib/python2.6/test/test_scope.pyR9     s    (    (   R'   R&   R(   (   R   R   (   R&   s,   /mit/python/lib/python2.6/test/test_scope.pyR9     s    (    (   R   R   R   (    (   R   R   s,   /mit/python/lib/python2.6/test/test_scope.pyR9     s    i   i   i   (   R   t   None(	   R	   t   f1R
   R   t   f2t   f3t   f8R!   R    (    (   R   s,   /mit/python/lib/python2.6/test/test_scope.pyt   testLambdasþ   s$    			c      
   B   s~   d „  } d „  } y | ƒ  Wn e  j
 o n X|  i ƒ  y | ƒ  Wn e j
 o n X|  i ƒ  d h |  i d 6Ud  S(   Nc             s   ˆ  GH‡  f d †  }  d ‰  d  S(   Nc              s   ˆ  S(   N(    (    (   R   (    s,   /mit/python/lib/python2.6/test/test_scope.pyt   inner  s    i   (    (   R@   (    (   R   s,   /mit/python/lib/python2.6/test/test_scope.pyt   errorInOuter  s    c             s    ‡  f d †  }  |  ƒ  d ‰  d  S(   Nc              s   ˆ  S(   N(    (    (   R   (    s,   /mit/python/lib/python2.6/test/test_scope.pyR@     s    i   (    (   R@   (    (   R   s,   /mit/python/lib/python2.6/test/test_scope.pyt   errorInInner  s    s–   
global_x = 1
def f():
    global_x += 1
try:
    f()
except UnboundLocalError:
    pass
else:
    fail('scope of global_x not correctly determined')
t   fail(   t   UnboundLocalErrorRC   t	   NameError(   R	   RA   RB   (    (    s,   /mit/python/lib/python2.6/test/test_scope.pyt   testUnboundLocal  s    		

c         C   sz   d „  } |  i  | d d d ƒ ƒ  d ƒ d „  } |  i  | d d ƒ ƒ  d d ƒ d „  } |  i  | d ƒ d ƒ d ƒ d  S(   Nc             s   ‡  f d †  } | S(   Nc              s   ˆ  S(   N(    (    (   t   lst(    s,   /mit/python/lib/python2.6/test/test_scope.pyt   returnerB  s    (    (   RG   RH   (    (   RG   s,   /mit/python/lib/python2.6/test/test_scope.pyt   makeReturnerA  s    i   i   i   c             s   ‡  f d †  } | S(   Nc              s   ˆ  S(   N(    (    (   t   kwargs(    s,   /mit/python/lib/python2.6/test/test_scope.pyRH   I  s    (    (   RJ   RH   (    (   RJ   s,   /mit/python/lib/python2.6/test/test_scope.pyt   makeReturner2H  s    R'   i   c            s"   |  \ ‰  ‰ ‡  ‡ f d †  } | S(   Nc            s   |  \ } } ˆ  | ˆ | f S(   N(    (   t   .0R(   t   d(   R'   R&   (    s,   /mit/python/lib/python2.6/test/test_scope.pyt   addPairP  s    	(    (   RL   R'   R&   RN   (    (   R'   R&   s,   /mit/python/lib/python2.6/test/test_scope.pyt   makeAddPairO  s    	id   iÈ   ie   iÊ   (   i   i   i   (   i   i   (   id   iÈ   (   ie   iÊ   (   R   (   R	   RI   RK   RO   (    (    s,   /mit/python/lib/python2.6/test/test_scope.pyt   testComplexDefinitions?  s    		 	c         B   s   d d  Ud  S(   NsÉ  # I
x = 7
def f():
    x = 1
    def g():
        global x
        def i():
            def h():
                return x
            return h()
        return i()
    return g()
self.assertEqual(f(), 7)
self.assertEqual(x, 7)

# II
x = 7
def f():
    x = 1
    def g():
        x = 2
        def i():
            def h():
                return x
            return h()
        return i()
    return g()
self.assertEqual(f(), 2)
self.assertEqual(x, 7)

# III
x = 7
def f():
    x = 1
    def g():
        global x
        x = 2
        def i():
            def h():
                return x
            return h()
        return i()
    return g()
self.assertEqual(f(), 2)
self.assertEqual(x, 2)

# IV
x = 7
def f():
    x = 3
    def g():
        global x
        x = 2
        def i():
            def h():
                return x
            return h()
        return i()
    return g()
self.assertEqual(f(), 2)
self.assertEqual(x, 2)

# XXX what about global statements in class blocks?
# do they affect methods?

x = 12
class Global:
    global x
    x = 13
    def set(self, val):
        x = val
    def get(self):
        return x

g = Global()
self.assertEqual(g.get(), 13)
g.set(15)
self.assertEqual(g.get(), 13)
(    (   R	   (    (    s,   /mit/python/lib/python2.6/test/test_scope.pyt   testScopeOfGlobalStmtV  s    Rc            s]   d d ‡  f d †  ƒ  Y‰  ‡  f d †  } x t  d ƒ D] } | ƒ  q5 W|  i ˆ  i d ƒ d  S(   Nt   Fooc              s,   e  Z d  Z ‡  f d †  Z ‡  f d †  Z RS(   i    c            s   ˆ  i  d 7_  d  S(   Ni   (   t   count(   R	   (   RR   (    s,   /mit/python/lib/python2.6/test/test_scope.pyt   __init__¯  s    c            s   ˆ  i  d 8_  d  S(   Ni   (   RS   (   R	   (   RR   (    s,   /mit/python/lib/python2.6/test/test_scope.pyt   __del__²  s    (   R   R   RS   RT   RU   (    (   RR   (    s,   /mit/python/lib/python2.6/test/test_scope.pyRR   ¬  s   c             s#   ˆ ƒ  ‰  ‡  f d †  }  |  ƒ  d  S(   Nc              s   ˆ  S(   N(    (    (   R   (    s,   /mit/python/lib/python2.6/test/test_scope.pyR<   ·  s    (    (   R<   (   RR   (   R   s,   /mit/python/lib/python2.6/test/test_scope.pyR;   µ  s    	id   i    (    (   t   rangeR   RS   (   R	   R;   t   i(    (   RR   s,   /mit/python/lib/python2.6/test/test_scope.pyt	   testLeaksª  s    	 c         B   s   d d  Ud  S(   Ns³  def test(x):
    class Foo:
        global x
        def __call__(self, y):
            return x + y
    return Foo()

x = 0
self.assertEqual(test(6)(2), 8)
x = -1
self.assertEqual(test(3)(2), 5)

looked_up_by_load_name = False
class X:
    # Implicit globals inside classes are be looked up by LOAD_NAME, not
    # LOAD_GLOBAL.
    locals()['looked_up_by_load_name'] = True
    passed = looked_up_by_load_name

self.assert_(X.passed)
(    (   R	   (    (    s,   /mit/python/lib/python2.6/test/test_scope.pyt   testClassAndGlobalÀ  s    c         C   sa   d „  } | d ƒ d ƒ } |  i  | i d ƒ ƒ | d =|  i | h d d 6d d 6d d	 6ƒ d  S(
   Nc            s   ‡  f d †  } | S(   Nc            s*   ‡  f d †  } ˆ ˆ  } ˆ  d 7‰  t  ƒ  S(   Nc            s   ˆ  |  S(   N(    (   R   (   R   (    s,   /mit/python/lib/python2.6/test/test_scope.pyR    Ý  s    i   (   t   locals(   R   R    t   w(   R   (   R   s,   /mit/python/lib/python2.6/test/test_scope.pyR!   Ü  s    

(    (   R   R!   (    (   R   s,   /mit/python/lib/python2.6/test/test_scope.pyR"   Û  s    i   i   R    R   i   R   i   R[   (   t   assert_t   has_keyR   (   R	   R"   RM   (    (    s,   /mit/python/lib/python2.6/test/test_scope.pyt   testLocalsFunctionÙ  s
    		c         C   sd   d „  } |  i  | d ƒ i d ƒ d „  } | d ƒ i } |  i d | j ƒ |  i d | j ƒ d  S(   Nc            s   d d ‡  f d †  ƒ  Y} | S(   Nt   Cc              s$   e  Z d  Z ‡  f d †  Z e ƒ  RS(   i   c            s   ˆ  S(   N(    (   R	   (   R   (    s,   /mit/python/lib/python2.6/test/test_scope.pyt   m÷  s    (   R   R   R   R`   RZ   (    (   R   (    s,   /mit/python/lib/python2.6/test/test_scope.pyR_   õ  s   (    (    (   R   R_   (    (   R   s,   /mit/python/lib/python2.6/test/test_scope.pyR"   ô  s    i   i   c            s   d d ‡  f d †  ƒ  Y} | S(   NR_   c              s,   e  Z ˆ  Z ‡  f d  †  Z e e ƒ  ƒ Z RS(   c            s   ˆ  S(   N(    (   R	   (   R   (    s,   /mit/python/lib/python2.6/test/test_scope.pyR`     s    (   R   R   R   R`   t   listRZ   R   (    (   R   (    s,   /mit/python/lib/python2.6/test/test_scope.pyR_   ÿ  s   (    (    (   R   R_   (    (   R   s,   /mit/python/lib/python2.6/test/test_scope.pyR"   þ  s    R   R   (   R   R   R   R\   (   R	   R"   t   varnames(    (    s,   /mit/python/lib/python2.6/test/test_scope.pyt   testLocalsClassé  s    		c            sd   d d  k  } | i d „  ƒ z3 d ‰  d d ‡  f d †  ƒ  Y} |  i ˆ  d ƒ Wd  | i d  ƒ Xd  S(   Niÿÿÿÿc         S   s   d  S(   N(   R:   (   R'   R&   R(   (    (    s,   /mit/python/lib/python2.6/test/test_scope.pyR9     s    i   R_   c              s   e  Z ‡  f d  †  Z RS(   c            s   ˆ  S(   N(    (   R	   (   R   (    s,   /mit/python/lib/python2.6/test/test_scope.pyR"     s    (   R   R   R"   (    (   R   (    s,   /mit/python/lib/python2.6/test/test_scope.pyR_     s   (    (   t   syst   settracet   assertEqualsR:   (   R	   Rd   R_   (    (   R   s,   /mit/python/lib/python2.6/test/test_scope.pyt   testLocalsClass_WithTrace
  s    c         C   s5   d „  } | d ƒ ƒ  } |  i  | i | i ƒ  ƒ d  S(   Nc            s   d d ‡  f d †  ƒ  Y} | S(   NR_   c              s   e  Z ‡  f d  †  Z ˆ  Z RS(   c            s   ˆ  S(   N(    (   R	   (   R   (    s,   /mit/python/lib/python2.6/test/test_scope.pyR`   !  s    (   R   R   R`   R'   (    (   R   (    s,   /mit/python/lib/python2.6/test/test_scope.pyR_      s   (    (    (   R   R_   (    (   R   s,   /mit/python/lib/python2.6/test/test_scope.pyR"     s    i   (   R   R'   R`   (   R	   R"   t   inst(    (    s,   /mit/python/lib/python2.6/test/test_scope.pyt   testBoundAndFree  s    	c            sx   d d  k  } ‡  f d †  ‰  d „  } d d	 d „  ƒ  Y} | i ˆ  ƒ | d | d
 ƒ | i d  ƒ |  i t | i ƒ d  S(   Niÿÿÿÿc            s   ˆ  S(   N(    (   R'   R&   R(   (   t   tracer(    s,   /mit/python/lib/python2.6/test/test_scope.pyRj   ,  s    c            sO   | \ } ‰  | d j o2 ˆ  d j o d | i  |  f ‰  n ‡  f d †  Sd  S(   Ni   t    s   _%s__%sc            s   t  |  ˆ  ƒ S(    (   t   getattr(   t   obj(   t   des(    s,   /mit/python/lib/python2.6/test/test_scope.pyR9   4  s    (   R   (   t   namet   klasst   gettert   kind(    (   Rn   s,   /mit/python/lib/python2.6/test/test_scope.pyt   adaptgetter/  s
    t	   TestClassc           B   s   e  Z RS(    (   R   R   (    (    (    s,   /mit/python/lib/python2.6/test/test_scope.pyRt   6  s   t   fooi   Rk   (    (   i   Rk   (   Rd   Re   R:   t   assertRaisest	   TypeError(   R	   Rd   Rs   Rt   (    (   Rj   s,   /mit/python/lib/python2.6/test/test_scope.pyt   testInteractionWithTraceFunc)  s    	c         B   sa   d „  } | d ƒ } |  i  e e | i ƒ y | i h  UWn e j
 o n X|  i d ƒ d  S(   Nc            s   ‡  f d †  S(   Nc              s   ˆ  d  S(   i   (    (    (   R   (    s,   /mit/python/lib/python2.6/test/test_scope.pyR9   B  s    (    (   R   (    (   R   s,   /mit/python/lib/python2.6/test/test_scope.pyR"   A  s    i   s9   exec should have failed, because code contained free vars(   Rv   Rw   t   evalt	   func_codeRC   (   R	   R"   R!   (    (    s,   /mit/python/lib/python2.6/test/test_scope.pyt   testEvalExecFreeVars?  s    	c         C   sW   y	 t  GHWn t j
 o n Xd GHd „  } | ƒ  y	 t  GHWn t j
 o n Xd  S(   Ns   bad should not be definedc          S   s6   g  }  d D]  } | i  ƒ  D] } |  | q q ~  d  S(   Ns   a b(   t   split(   t   _[1]t   st   bad(    (    s,   /mit/python/lib/python2.6/test/test_scope.pyR   W  s    (   R   RE   (   R	   R   (    (    s,   /mit/python/lib/python2.6/test/test_scope.pyt   testListCompLocalVarsN  s    			c         C   s   d „  } | d ƒ ƒ  d  S(   Nc            s   ‡  f d †  } | S(   Nc              s   ˆ  t  d ƒ d  S(   Ns   x + 1(   Ry   (    (   R   (    s,   /mit/python/lib/python2.6/test/test_scope.pyR!   c  s    (    (   R   R!   (    (   R   s,   /mit/python/lib/python2.6/test/test_scope.pyR"   b  s    i   (    (   R	   R"   (    (    s,   /mit/python/lib/python2.6/test/test_scope.pyt   testEvalFreeVars`  s    	c            s-   d d d „  ƒ  Y‰  ‡  f d †  } | ƒ  d  S(   Nt   Specialc           B   s   e  Z d  „  Z RS(   c         S   s   t  ƒ  d  S(   N(   t   nestedcell_get(   R	   (    (    s,   /mit/python/lib/python2.6/test/test_scope.pyRU   n  s    (   R   R   RU   (    (    (    s,   /mit/python/lib/python2.6/test/test_scope.pyR‚   m  s   c              s%   ‡  f d †  a  ˆ ƒ  f ‰  d ‰  d  S(   Nc              s   ˆ  S(   N(    (    (   R(   (    s,   /mit/python/lib/python2.6/test/test_scope.pyRƒ   s  s    i   (   Rƒ   (    (   R‚   (   R(   s,   /mit/python/lib/python2.6/test/test_scope.pyR"   q  s    (    (    (   R	   R"   (    (   R‚   s,   /mit/python/lib/python2.6/test/test_scope.pyt   testFreeingCellj  s    (   R   R   R   R   R   R   R   R   R$   R)   R3   R7   R8   R?   RF   RP   RQ   RX   RY   R^   Rc   Rg   Ri   Rx   R{   R€   R   R„   (    (    (    s,   /mit/python/lib/python2.6/test/test_scope.pyR      s4   									%		E		)		T				!						
c           C   s   t  t ƒ d  S(   N(   R   R   (    (    (    s,   /mit/python/lib/python2.6/test/test_scope.pyt	   test_main}  s    t   __main__(   t   unittestt   test.test_supportR    R   t   warningst   filterwarningst   SyntaxWarningt   TestCaseR   R…   R   (    (    (    s,   /mit/python/lib/python2.6/test/test_scope.pyt   <module>   s   ÿ ÿ w	