Server : LiteSpeed
System : Linux server51.dnsbootclub.com 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
User : nandedex ( 1060)
PHP Version : 8.1.33
Disable Function : NONE
Directory :  /opt/cppython/lib/python3.8/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]


Current File : //opt/cppython/lib/python3.8/test/__pycache__/test_scope.cpython-38.opt-1.pyc
U

>��g�N�@sFddlZddlZddlmZmZGdd�dej�ZedkrBe��dS)�N)�check_syntax_error�cpython_onlyc@sHeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zed-d.��Zd/d0�Zed1d2��Zd3d4�Zd5d6�Zd7d8�Zd9d:�Z d;d<�Z!d=d>�Z"d?d@�Z#dAdB�Z$dCdD�Z%dEdF�Z&dGdH�Z'dIdJ�Z(edKdL��Z)dMS)N�
ScopeTestscCs<dd�}|d�}|d�}|�|d�d�|�|d�d�dS)Ncs�fdd�}|S)Ncs�|S�N���y��xr�./opt/cppython/lib/python3.8/test/test_scope.py�addersz?ScopeTests.testSimpleNesting.<locals>.make_adder.<locals>.adderr�r
rrr	r�
make_addersz0ScopeTests.testSimpleNesting.<locals>.make_adder��
�������assertEqual)�selfr�inc�plus10rrr�testSimpleNesting	s
zScopeTests.testSimpleNestingcCs<dd�}|d�}|d�}|�|d�d�|�|d�d�dS)Ncs�fdd�}|�S)Ncs�fdd�}|S)Ncs�|Srrrr	rrrszNScopeTests.testExtraNesting.<locals>.make_adder2.<locals>.extra.<locals>.adderr�rr	rr�extrasz?ScopeTests.testExtraNesting.<locals>.make_adder2.<locals>.extrar)r
rrr	r�make_adder2sz0ScopeTests.testExtraNesting.<locals>.make_adder2rrrrrr)rrrrrrr�testExtraNestings
zScopeTests.testExtraNestingcCs<dd�}|d�}|d�}|�|d�d�|�|d�d�dS)	Ncs�fdd�}�d�|S)Ncs�|Srrrr	rrr(szEScopeTests.testSimpleAndRebinding.<locals>.make_adder3.<locals>.adderrrr
rr	r�make_adder3'sz6ScopeTests.testSimpleAndRebinding.<locals>.make_adder3r�	rrrrr)rrrrrrr�testSimpleAndRebinding%s
z!ScopeTests.testSimpleAndRebindingcs>�fdd�}d�|�}|�|d�d�d�|�|d�d�dS)Ncs�fdd�}|�S)Ncs�fdd�}|�S)Ncs�fdd�}|S)Ncs�|Srrr�Zglobal_xrrr8szbScopeTests.testNestingGlobalNoFree.<locals>.make_adder4.<locals>.nest.<locals>.nest.<locals>.adderrrr!rr�nest7szSScopeTests.testNestingGlobalNoFree.<locals>.make_adder4.<locals>.nest.<locals>.nestr�r"r!rrr"6szEScopeTests.testNestingGlobalNoFree.<locals>.make_adder4.<locals>.nestrr#r!rr�make_adder45sz7ScopeTests.testNestingGlobalNoFree.<locals>.make_adder4rrrrrr)rr$rrr!r�testNestingGlobalNoFree3s	z"ScopeTests.testNestingGlobalNoFreecCs<dd�}|d�}|d�}|�|d�d�|�|d�d�dS)NcsG�fdd�d�}|�S)NcseZdZ�fdd�ZdS)zFScopeTests.testNestingThroughClass.<locals>.make_adder5.<locals>.Addercs�|Srr)rrr	rr�__call__IszOScopeTests.testNestingThroughClass.<locals>.make_adder5.<locals>.Adder.__call__N)�__name__�
__module__�__qualname__r&rr	rr�AdderHsr*r)r
r*rr	r�make_adder5Gsz7ScopeTests.testNestingThroughClass.<locals>.make_adder5rrrrrr)rr+rrrrr�testNestingThroughClassEs
z"ScopeTests.testNestingThroughClasscCs<dd�}|d�}|d�}|�|d�d�|�|d�d�dS)NcSsdd�}|a|S)NcSst|Sr�Z
global_nest_xrrrrrWszMScopeTests.testNestingPlusFreeRefToGlobal.<locals>.make_adder6.<locals>.adderr-r
rrr�make_adder6Usz>ScopeTests.testNestingPlusFreeRefToGlobal.<locals>.make_adder6rr�rrr)rr.rrrrr�testNestingPlusFreeRefToGlobalSs
z)ScopeTests.testNestingPlusFreeRefToGlobalcCs$dd�}|d�}|�|d�d�dS)NcSsdd�}|d�S)Ncsd��fdd�}|S)N�*cs�|Srr��zr	rr�hgszEScopeTests.testNearestEnclosingScope.<locals>.f.<locals>.g.<locals>.hr)rr4rr	r�gesz:ScopeTests.testNearestEnclosingScope.<locals>.f.<locals>.grr�r
r5rrr�fdsz/ScopeTests.testNearestEnclosingScope.<locals>.fr��/r)rr7Z	test_funcrrr�testNearestEnclosingScopebsz$ScopeTests.testNearestEnclosingScopecs>dd���fdd�}|ddd�}|ddd	�}|�|�d
�dS)NcSs|Srrr	rrr�identityqsz9ScopeTests.testMixedFreevarsAndCellvars.<locals>.identitycs���fdd�}|S)Ncs&|�}����fdd�}|��|S)Ncs�����Srrr)�br;rr3rrr4wszHScopeTests.testMixedFreevarsAndCellvars.<locals>.f.<locals>.g.<locals>.hr)�ar<�cr4)r;r
r3)r<rrr5usz=ScopeTests.testMixedFreevarsAndCellvars.<locals>.f.<locals>.gr)r
rr3r5�r;)r
r3rr7tsz2ScopeTests.testMixedFreevarsAndCellvars.<locals>.frr����'r�rr7r5r4rr?r�testMixedFreevarsAndCellvarsos
z'ScopeTests.testMixedFreevarsAndCellvarscs�dd�}|�}|�|��d�|�|��d�|�|��d�d�G�fdd�d�}|�}|�|��d�|�|��d�|�|��d�dS)Ncsd�G�fdd�d�}|�S)N�varcs0eZdZdd�Z�fdd�Zdd�Zdd�Zd	S)
z:ScopeTests.testFreeVarInMethod.<locals>.test.<locals>.TestcSsdS�N�methodr�rrrr�method_and_var�szIScopeTests.testFreeVarInMethod.<locals>.test.<locals>.Test.method_and_varcs�SrrrI�rJrr�test�sz?ScopeTests.testFreeVarInMethod.<locals>.test.<locals>.Test.testcSstd�S�N�global��strrIrrr�
actual_global�szHScopeTests.testFreeVarInMethod.<locals>.test.<locals>.Test.actual_globalcSst|�SrrOrIrrrrP�sz>ScopeTests.testFreeVarInMethod.<locals>.test.<locals>.Test.strN�r'r(r)rJrLrQrPrrKrr�Test�srSr)rSrrKrrL�s	z,ScopeTests.testFreeVarInMethod.<locals>.testrFrHrNcs0eZdZdd�Z�fdd�Zdd�Zdd�Zd	S)
z,ScopeTests.testFreeVarInMethod.<locals>.TestcSsdSrGrrIrrrrJ�sz;ScopeTests.testFreeVarInMethod.<locals>.Test.method_and_varcs�SrrrIrKrrrL�sz1ScopeTests.testFreeVarInMethod.<locals>.Test.testcSstd�SrMrOrIrrrrQ�sz:ScopeTests.testFreeVarInMethod.<locals>.Test.actual_globalcSst|�SrrOrIrrrrP�sz0ScopeTests.testFreeVarInMethod.<locals>.Test.strNrRrrKrrrS�srS)rrLrJrQ)rrL�trSrrKr�testFreeVarInMethod�s
zScopeTests.testFreeVarInMethodcCs2dd�dd�}|�|dd�d�|�|�d�dS)N��r=cs�fdd�}|�dS)Ncs�dS)Nr8rrrWrr�bar�sz8ScopeTests.testCellIsKwonlyArg.<locals>.foo.<locals>.barr@r)r=rXrrWr�foo�sz+ScopeTests.testCellIsKwonlyArg.<locals>.foor1�2�r)rrYrrr�testCellIsKwonlyArg�szScopeTests.testCellIsKwonlyArgcCsdd�}|�|d�d�dS)Ncs(�fdd��|dkr�|�Std��dS)Ncs |dkrdS|�|d�SdS)Nrrr)�n��factrrr_�sz1ScopeTests.testRecursion.<locals>.f.<locals>.factrzx must be >= 0)�
ValueErrorr	rr^rr7�sz#ScopeTests.testRecursion.<locals>.frBi�r�rr7rrr�
testRecursion�szScopeTests.testRecursioncCs,t|d�t|d�t|d�t|d�dS)Nz�if 1:
            def unoptimized_clash1(strip):
                def f(s):
                    from sys import *
                    return getrefcount(s) # ambiguity: free or local
                return f
            z�if 1:
            def unoptimized_clash2():
                from sys import *
                def f(s):
                    return getrefcount(s) # ambiguity: global or local
                return f
            z�if 1:
            def unoptimized_clash2():
                from sys import *
                def g():
                    def f(s):
                        return getrefcount(s) # ambiguity: global or local
                    return f
            z�if 1:
            def f():
                def g():
                    from sys import *
                    return getrefcount # global or local?
            )rrIrrr�testUnoptimizedNamespaces�s


	z$ScopeTests.testUnoptimizedNamespacesc	s�dd�}|d�}|d�}|�|d�d�|�|d�d�dd�}|d�}|d�}|�|d�d�|�|d�d��fd	d�}d�|d�}|�|d�d
�dd�}|ddd
�}|ddd
�}|�|�d�dS)Ncs�fdd�S)Ncs�|Srrrr	rr�<lambda>���:ScopeTests.testLambdas.<locals>.<lambda>.<locals>.<lambda>rr	rr	rrd�rez(ScopeTests.testLambdas.<locals>.<lambda>rrrr8�cs�fdd��S)Ncs�fdd�S)Ncs�|Srrrr	rrrd�re�LScopeTests.testLambdas.<locals>.<lambda>.<locals>.<lambda>.<locals>.<lambda>rrr	rrrd�rerfrr	rr	rrd�recs�fdd�S)Ncs�|Srrrr!rrrd�rerfrr	r!rrrd�rer@cs��fdd�S)Ncs���fdd�S)Ncs���Srrr)r<rr3rrrd�rerhr�r=r<r>�rr3)r<rrd�rerfr)r
rr3rrjrrd�rerArB�r)	r�f1rr�f2Zf3Zf8r5r4rr!r�testLambdas�s$zScopeTests.testLambdascCs,dd�}dd�}|�t|�|�t|�dS)Ncst���fdd�}d�dS)Ncs�Srrrrrr�innersz@ScopeTests.testUnboundLocal.<locals>.errorInOuter.<locals>.innerr��print�rorrr�errorInOuter�sz1ScopeTests.testUnboundLocal.<locals>.errorInOutercs�fdd�}|�d�dS)Ncs�Srrrrrrrosz@ScopeTests.testUnboundLocal.<locals>.errorInInner.<locals>.innerrrrrrrr�errorInInnersz1ScopeTests.testUnboundLocal.<locals>.errorInInner��assertRaises�UnboundLocalError�	NameError�rrsrtrrr�testUnboundLocal�szScopeTests.testUnboundLocalcCs,dd�}dd�}|�t|�|�t|�dS)Ncsd��t���fdd�}dS)Nrcs�SrrrrrrroszIScopeTests.testUnboundLocal_AfterDel.<locals>.errorInOuter.<locals>.innerrprrrrrrssz:ScopeTests.testUnboundLocal_AfterDel.<locals>.errorInOutercs�fdd�}d��|�dS)Ncs�SrrrrrrroszIScopeTests.testUnboundLocal_AfterDel.<locals>.errorInInner.<locals>.innerrrrrrrrrtsz:ScopeTests.testUnboundLocal_AfterDel.<locals>.errorInInnerruryrrr�testUnboundLocal_AfterDelsz$ScopeTests.testUnboundLocal_AfterDelcCstdd|ji�dS)Naif 1:
            global_x = 1
            def f():
                global_x += 1
            try:
                f()
            except UnboundLocalError:
                pass
            else:
                fail('scope of global_x not correctly determined')
            �fail)�execr|rIrrr�testUnboundLocal_AugAssign#s
�z%ScopeTests.testUnboundLocal_AugAssigncCsBdd�}|�|ddd��d�dd�}|�|d	d
��dd	�dS)Ncs�fdd�}|S)Ncs�Srrr��lstrr�returner4szIScopeTests.testComplexDefinitions.<locals>.makeReturner.<locals>.returnerr)r�r�rrr�makeReturner3sz7ScopeTests.testComplexDefinitions.<locals>.makeReturnerrrr@)rrr@cs�fdd�}|S)Ncs�Srrr��kwargsrrr�;szJScopeTests.testComplexDefinitions.<locals>.makeReturner2.<locals>.returnerr)r�r�rr�r�
makeReturner2:sz8ScopeTests.testComplexDefinitions.<locals>.makeReturner2r/rWr=r)rr�r�rrr�testComplexDefinitions1sz!ScopeTests.testComplexDefinitionscCstd�dS)Na;if 1:
            # 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}rIrrr�testScopeOfGlobalStmtAsz ScopeTests.testScopeOfGlobalStmtcsDG�fdd�d���fdd�}td�D]
}|�q&|��jd�dS)Ncs(eZdZdZ�fdd�Z�fdd�ZdS)z!ScopeTests.testLeaks.<locals>.Foorcs�jd7_dS�Nr��countrI��Foorr�__init__�sz*ScopeTests.testLeaks.<locals>.Foo.__init__cs�jd8_dSr�r�rIr�rr�__del__�sz)ScopeTests.testLeaks.<locals>.Foo.__del__N)r'r(r)r�r�r�rr�rrr��sr�cs����fdd�}|�dS)Ncs�Srrrr	rrrm�sz,ScopeTests.testLeaks.<locals>.f1.<locals>.f2r)rmr�r	rrl�sz ScopeTests.testLeaks.<locals>.f1�dr)�rangerr�)rrl�irr�r�	testLeaks�s
	zScopeTests.testLeakscCstd�dS)Na�if 1:
            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.assertTrue(X.passed)
            r�rIrrr�testClassAndGlobal�szScopeTests.testClassAndGlobalcCs>dd�}|d�d�}|�d|�|d=|�|dddd��dS)	Ncs�fdd�}|S)Ncs"�fdd�}��}�d7�t�S)Ncs�|Srrr2rrrr4�sz>ScopeTests.testLocalsFunction.<locals>.f.<locals>.g.<locals>.hr@)�locals)rr4�wr	rrr5�sz3ScopeTests.testLocalsFunction.<locals>.f.<locals>.grr6rr	rr7�sz(ScopeTests.testLocalsFunction.<locals>.frrAr4�rB)r
rr�)�assertInr)rr7�drrr�testLocalsFunction�s
	zScopeTests.testLocalsFunctioncCsHdd�}|�|d�jd�dd�}|d�j}|�d|�|�d|�dS)NcsG�fdd�d�}|S)Ncs"eZdZdZ�fdd�Ze�dS)�0ScopeTests.testLocalsClass.<locals>.f.<locals>.C�cs�SrrrIr	rr�m�s�2ScopeTests.testLocalsClass.<locals>.f.<locals>.C.mN)r'r(r)r
r�r�rr	rr�C�sr�r�r
r�rr	rr7�sz%ScopeTests.testLocalsClass.<locals>.frr�csG�fdd�d�}|S)Ncs&eZdZ�Z�fdd�Zee��ZdS)r�cs�SrrrIr	rrr��sr�N)r'r(r)rr��listr�r3rr	rrr��sr�rr�rr	rr7�sr
r)rr
r3�assertNotInr�)rr7Zvarnamesrrr�testLocalsClass�s
zScopeTests.testLocalsClasscsNddl}|�|j|���|�dd��d�G�fdd�d�}|��d�dS)NrcSsdSrrrirrrrd�rez6ScopeTests.testLocalsClass_WithTrace.<locals>.<lambda>r�cseZdZ�fdd�ZdS)z/ScopeTests.testLocalsClass_WithTrace.<locals>.Ccs�SrrrIr	rrr7sz1ScopeTests.testLocalsClass_WithTrace.<locals>.C.fN)r'r(r)r7rr	rrr�sr�)�sys�
addCleanup�settrace�gettracer)rr�r�rr	r�testLocalsClass_WithTrace�sz$ScopeTests.testLocalsClass_WithTracecCs(dd�}|d��}|�|j|���dS)NcsG�fdd�d�}|S)NcseZdZ�fdd�Z�ZdS)z1ScopeTests.testBoundAndFree.<locals>.f.<locals>.Ccs�SrrrIr	rrr�sz3ScopeTests.testBoundAndFree.<locals>.f.<locals>.C.mN)r'r(r)r�r=rr	rrr�
sr�rr�rr	rr7	sz&ScopeTests.testBoundAndFree.<locals>.fr@)rr=r�)rr7�instrrr�testBoundAndFrees
zScopeTests.testBoundAndFreecsnddl}�fdd��dd�}Gdd�d�}|�|j|���|���|d|d	�|�d�|�t|j�dS)
Nrcs�Srrri��tracerrrr�sz7ScopeTests.testInteractionWithTraceFunc.<locals>.tracercs6|\}�|dkr2�dkr&d|j|f��fdd�SdS)Nr�z_%s__%scs
t|��Sr)�getattr)�obj�ZdesrrrdrezNScopeTests.testInteractionWithTraceFunc.<locals>.adaptgetter.<locals>.<lambda>)r')�name�klass�getter�kindrr�r�adaptgetters
z<ScopeTests.testInteractionWithTraceFunc.<locals>.adaptgetterc@seZdZdS)z:ScopeTests.testInteractionWithTraceFunc.<locals>.TestClassN)r'r(r)rrrr�	TestClass!sr�rY)rr�)r�r�r�r�rv�	TypeError)rr�r�r�rr�r�testInteractionWithTraceFuncs

z'ScopeTests.testInteractionWithTraceFunccCsTdd�}|d�}|�tt|j�zt|ji�Wntk
rDYnX|�d�dS)Ncs�fdd�S)Ncs�dSr�rrr	rrrd.rez<ScopeTests.testEvalExecFreeVars.<locals>.f.<locals>.<lambda>rr	rr	rr7-sz*ScopeTests.testEvalExecFreeVars.<locals>.fr@z9exec should have failed, because code contained free vars)rvr��eval�__code__r}r|�rr7r5rrr�testEvalExecFreeVars+szScopeTests.testEvalExecFreeVarscCs^ztt�Wntk
r Yn
Xtd�dd�}|�ztt�Wntk
rXYnXdS)Nzbad should not be definedcSsdd�dD�dS)NcSsg|]}|��D]}|�qqSr)�split)�.0�s�badrrr�
<listcomp>Ds
z?ScopeTests.testListCompLocalVars.<locals>.x.<locals>.<listcomp>za brrrrrr
Csz+ScopeTests.testListCompLocalVars.<locals>.x)rqr�rx)rr
rrr�testListCompLocalVars:sz ScopeTests.testListCompLocalVarscCsdd�}|d��dS)Ncs�fdd�}|S)Ncs�td�dS)Nzx + 1)r�rr	rrr5Osz1ScopeTests.testEvalFreeVars.<locals>.f.<locals>.grr6rr	rr7Nsz&ScopeTests.testEvalFreeVars.<locals>.frArrarrr�testEvalFreeVarsLszScopeTests.testEvalFreeVarscCsGdd�d�}dS)Nc@seZdZdd�ZdS)z+ScopeTests.testFreeingCell.<locals>.SpecialcSs
t�dSr)Znestedcell_getrIrrrr�Zsz3ScopeTests.testFreeingCell.<locals>.Special.__del__N)r'r(r)r�rrrr�SpecialYsr�r)rr�rrr�testFreeingCellVszScopeTests.testFreeingCellcCsPdd�}|d�\}}|�|�d�|�|�d�|�|�d�|�|�d�dS)Ncs �fdd�}�fdd�}||fS)Ncs�d7��Sr�rrr	rrr`sz7ScopeTests.testNonLocalFunction.<locals>.f.<locals>.inccs�d8��Sr�rrr	rr�decdsz7ScopeTests.testNonLocalFunction.<locals>.f.<locals>.decr)r
rr�rr	rr7_sz*ScopeTests.testNonLocalFunction.<locals>.frrrr)rr7rr�rrr�testNonLocalFunction]szScopeTests.testNonLocalFunctioncCsTdd�}|d�}|�|��d�|�|��d�|�|��d�|�|��d�dS)NcsG�fdd�d�}|�S)Ncs$eZdZ�fdd�Z�fdd�ZdS)z3ScopeTests.testNonLocalMethod.<locals>.f.<locals>.ccs�d7��Sr�rrIr	rrrssz7ScopeTests.testNonLocalMethod.<locals>.f.<locals>.c.inccs�d8��Sr�rrIr	rrr�wsz7ScopeTests.testNonLocalMethod.<locals>.f.<locals>.c.decN)r'r(r)rr�rr	rrr>rsr>r�r
r>rr	rr7qs	z(ScopeTests.testNonLocalMethod.<locals>.frrr)rrr��rr7r>rrr�testNonLocalMethodpszScopeTests.testNonLocalMethodcCs8i}i}td||�|�d|d�|�d|d�dS)NaCif 1:
            def f():
                y = 1
                def g():
                    global y
                    return y
                def h():
                    return y + 1
                return g, h
            y = 9
            g, h = f()
            result9 = g()
            result2 = h()
            rZresult2rZresult9)r}r)rZlocal_nsZ	global_nsrrr�#testGlobalInParallelNestedFunctions�s
�z.ScopeTests.testGlobalInParallelNestedFunctionscCs4dd�}|d�}|�|��d�|�d|jj�dS)NcsG�fdd�d�}|�S)Ncs eZdZ�d7��fdd�ZdS)z2ScopeTests.testNonLocalClass.<locals>.f.<locals>.crcs�SrrrIr	rr�get�sz6ScopeTests.testNonLocalClass.<locals>.f.<locals>.c.getN)r'r(r)r�rr	rrr>�sr>rr�rr	rr7�sz'ScopeTests.testNonLocalClass.<locals>.frrr
)rr�r��	__class__�__dict__r�rrr�testNonLocalClass�szScopeTests.testNonLocalClasscCs2dd�}|d�}|�t|d��dddddg�dS)	Ncs�fdd�}|S)Nc3s t|�D]}�d7��VqdSr�)r�)rr�r	rrr5�sz6ScopeTests.testNonLocalGenerator.<locals>.f.<locals>.grr6rr	rr7�sz+ScopeTests.testNonLocalGenerator.<locals>.frr8rrr@rA)rr�r�rrr�testNonLocalGenerator�sz ScopeTests.testNonLocalGeneratorcCs(dd�}|d�}|�}|�|�d�dS)Ncs�fdd�}|S)Ncs�d8��fdd�}|S)Nrcs�d7��S)NrArrr	rrr4�sz>ScopeTests.testNestedNonLocal.<locals>.f.<locals>.g.<locals>.hr)r4r	rrr5�sz3ScopeTests.testNestedNonLocal.<locals>.f.<locals>.grr6rr	rr7�sz(ScopeTests.testNestedNonLocal.<locals>.frr@rrDrrr�testNestedNonLocal�szScopeTests.testNestedNonLocalcCsdd�}dd�}dS)NcSsdSrrrWrrr�top�sz/ScopeTests.testTopIsNotSignificant.<locals>.topcSsdSrrrrrrr<�sz-ScopeTests.testTopIsNotSignificant.<locals>.br)rr�r<rrr�testTopIsNotSignificant�sz"ScopeTests.testTopIsNotSignificantcsRd�G�fdd�d�}|�|jd�Gdd�d�}|�t|d��|��d�dS)Nr1cseZdZde�d<�ZdS�z8ScopeTests.testClassNamespaceOverridesClosure.<locals>.X�+r
N)r'r(r)r�rrr	rr�X�s
r�r�c@seZdZde�d<[dSr�)r'r(r)r�r
rrrrr��s
r
)rrZassertFalse�hasattr)rr�rr	r�"testClassNamespaceOverridesClosure�sz-ScopeTests.testClassNamespaceOverridesClosurecCs8Gdd�d�}|�}|��t�|�}~|�|��dS)Nc@seZdZdd�ZdS)z'ScopeTests.testCellLeak.<locals>.Testerc
s>zddWn(tk
r4}z
|�_W5d}~XYnXd�dS)Nrr)�	Exception�exc)rr�rrIr�dig�s
z+ScopeTests.testCellLeak.<locals>.Tester.digN)r'r(r)r�rrrr�Tester�sr�)r��weakref�refZassertIsNone)rr�Ztesterr�rrr�testCellLeak�s
	
zScopeTests.testCellLeakN)*r'r(r)rrr r%r,r0r:rErUr\rbrcrnrzr{r~r�r�r�r�r�r�rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrsR

%"T!





r�__main__)	Zunittestr�Ztest.supportrrZTestCaserr'�mainrrrr�<module>sv

F1le Man4ger