
    g[                     X    d dl Z d dlmZmZ d dlmZmZ  G d de      Z G d de      Z	y)    N)messageschecker)TestCaseskipc                      e Zd Zd Zd Zd Zd Zd Z ed      d        Z	d Z
d	 Zd
 Zd Z ed      d        Z ed      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  ed      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/ Z0d0 Z1d1 Z2d2 Z3d3 Z4d4 Z5d5 Z6d6 Z7d7 Z8d8 Z9d9 Z:d: Z;d; Z<d< Z=d= Z>d> Z?d? Z@d@ ZAdA ZBdB ZCdC ZDdD ZEyE)FTestc                 D    | j                  dt        j                         y )NbarflakesmUndefinedNameselfs    e/var/www/html/brdwt/brdwt/brdwtenv/lib/python3.12/site-packages/pyflakes/test/test_undefined_names.pytest_undefinedzTest.test_undefined   s    E1??+    c                 &    | j                  d       y )Nz[a for a in range(10) if a]r   r   s    r   test_definedInListCompzTest.test_definedInListComp   s    12r   c                 D    | j                  dt        j                         y )Nz2
        [a for a in range(10)]
        a
        r   r   s    r   test_undefinedInListCompzTest.test_undefinedInListComp   s      OO		%r   c                 b    | j                  dt        j                  t        j                         y)zxException names can't be used after the except: block.

        The exc variable is unused inside the exception handler.zx
        try:
            raise ValueError('ve')
        except ValueError as exc:
            pass
        exc
        Nr   r   r   UnusedVariabler   s    r   test_undefinedExceptionNamez Test.test_undefinedExceptionName   s&     	  __a..	0r   c                 &    | j                  d       y)zLocals declared in except: blocks can be used after the block.

        This shows the example in test_undefinedExceptionName is
        different.zy
        try:
            raise ValueError('ve')
        except ValueError as exc:
            e = exc
        e
        Nr   r   s    r    test_namesDeclaredInExceptBlocksz%Test.test_namesDeclaredInExceptBlocks!       
 	  	r   z5error reporting disabled due to false positives belowc                 D    | j                  dt        j                         y)zException names obscure locals, can't be used after.

        Last line will raise UnboundLocalError on Python 3 after exiting
        the except: block. Note next two examples for false positives to
        watch out for.z
        exc = 'Original value'
        try:
            raise ValueError('ve')
        except ValueError as exc:
            pass
        exc
        Nr   r   s    r   1test_undefinedExceptionNameObscuringLocalVariablez6Test.test_undefinedExceptionNameObscuringLocalVariable.   s     	  OO	%r   c                 b    | j                  dt        j                  t        j                         y)zException names are unbound after the `except:` block.

        Last line will raise UnboundLocalError.
        The exc variable is unused inside the exception handler.
        z
        try:
            raise ValueError('ve')
        except ValueError as exc:
            pass
        print(exc)
        exc = 'Original value'
        Nr   r   s    r   2test_undefinedExceptionNameObscuringLocalVariable2z7Test.test_undefinedExceptionNameObscuringLocalVariable2?   s&     	  __a..	0r   c                 D    | j                  dt        j                         y)zException names obscure locals, can't be used after. Unless.

        Last line will never raise UnboundLocalError because it's only
        entered if no exception was raised.z
        exc = 'Original value'
        try:
            raise ValueError('ve')
        except ValueError as exc:
            print('exception logged')
            raise
        exc
        Nr   r   r   r   s    r   ?test_undefinedExceptionNameObscuringLocalVariableFalsePositive1zDTest.test_undefinedExceptionNameObscuringLocalVariableFalsePositive1N        
 	  	r   c                 &    | j                  d       y)z7The exception name can be deleted in the except: block.z\
        try:
            pass
        except Exception as exc:
            del exc
        Nr   r   s    r   test_delExceptionInExceptzTest.test_delExceptionInExcept]         	r   c                 D    | j                  dt        j                         y)zException names obscure locals, can't be used after. Unless.

        Last line will never raise UnboundLocalError because `error` is
        only falsy if the `except:` block has not been entered.z
        exc = 'Original value'
        error = None
        try:
            raise ValueError('ve')
        except ValueError as exc:
            error = 'exception logged'
        if error:
            print(error)
        else:
            exc
        Nr%   r   s    r   ?test_undefinedExceptionNameObscuringLocalVariableFalsePositive2zDTest.test_undefinedExceptionNameObscuringLocalVariableFalsePositive2f   s     
 	  	r   c                 D    | j                  dt        j                         y)zException names obscure globals, can't be used after.

        Last line will raise UnboundLocalError because the existence of that
        exception name creates a local scope placeholder for it, obscuring any
        globals, etc.z
        exc = 'Original value'
        def func():
            try:
                pass  # nothing is raised
            except ValueError as exc:
                pass  # block never entered, exc stays unbound
            exc
        Nr   r   UndefinedLocalr   s    r   2test_undefinedExceptionNameObscuringGlobalVariablez7Test.test_undefinedExceptionNameObscuringGlobalVariablex   s      	  $$		&r   c                 D    | j                  dt        j                         y)a  Exception names obscure globals, can't be used after.

        Last line will raise NameError on Python 3 because the name is
        locally unbound after the `except:` block, even if it's
        nonlocal. We should issue an error in this case because code
        only working correctly if an exception isn't raised, is invalid.
        Unless it's explicitly silenced, see false positives below.a   
        exc = 'Original value'
        def func():
            global exc
            try:
                raise ValueError('ve')
            except ValueError as exc:
                pass  # block never entered, exc stays unbound
            exc
        Nr.   r   s    r   3test_undefinedExceptionNameObscuringGlobalVariable2z8Test.test_undefinedExceptionNameObscuringGlobalVariable2   s      	 	 $$
	&r   c                 D    | j                  dt        j                         y)zException names obscure globals, can't be used after. Unless.

        Last line will never raise NameError because it's only entered
        if no exception was raised.a  
        exc = 'Original value'
        def func():
            global exc
            try:
                raise ValueError('ve')
            except ValueError as exc:
                print('exception logged')
                raise
            exc
        Nr%   r   s    r   @test_undefinedExceptionNameObscuringGlobalVariableFalsePositive1zETest.test_undefinedExceptionNameObscuringGlobalVariableFalsePositive1   s     
 	 
 
	r   c                 D    | j                  dt        j                         y)zException names obscure globals, can't be used after. Unless.

        Last line will never raise NameError because `error` is only
        falsy if the `except:` block has not been entered.aN  
        exc = 'Original value'
        def func():
            global exc
            error = None
            try:
                raise ValueError('ve')
            except ValueError as exc:
                error = 'exception logged'
            if error:
                print(error)
            else:
                exc
        Nr%   r   s    r   @test_undefinedExceptionNameObscuringGlobalVariableFalsePositive2zETest.test_undefinedExceptionNameObscuringGlobalVariableFalsePositive2   s     
 	  	r   c                 &    | j                  d       y )NzQ
        class a:
            def b():
                fu
        fu = 1
        r   r   s    r   test_functionsNeedGlobalScopez"Test.test_functionsNeedGlobalScope   s      	r   c                 &    | j                  d       y )Nz	range(10)r   r   s    r   test_builtinszTest.test_builtins   s    K r   c                 &    | j                  d       y)zm
        C{WindowsError} is sometimes a builtin name, so no warning is emitted
        for using it.
        WindowsErrorNr   r   s    r   test_builtinWindowsErrorzTest.test_builtinWindowsError       
 	N#r   c                 &    | j                  d       y)z
        Use of the C{__annotations__} in module scope should not emit
        an undefined name warning when version is greater than or equal to 3.6.
        __annotations__Nr   r   s    r   test_moduleAnnotationszTest.test_moduleAnnotations   s    
 	%&r   c                 &    | j                  d       y)zh
        Use of the C{__file__} magic global should not emit an undefined name
        warning.
        __file__Nr   r   s    r   test_magicGlobalsFilezTest.test_magicGlobalsFile       
 	Jr   c                 &    | j                  d       y)zl
        Use of the C{__builtins__} magic global should not emit an undefined
        name warning.
        __builtins__Nr   r   s    r   test_magicGlobalsBuiltinszTest.test_magicGlobalsBuiltins   r>   r   c                 &    | j                  d       y)zh
        Use of the C{__name__} magic global should not emit an undefined name
        warning.
        __name__Nr   r   s    r   test_magicGlobalsNamezTest.test_magicGlobalsName   rE   r   c                 j    | j                  dt        j                         | j                  dd       y)z
        Use of the C{__path__} magic global should not emit an undefined name
        warning, if you refer to it from a file called __init__.py.
        __path__zpackage/__init__.py)filenameNr   r   s    r   test_magicGlobalsPathzTest.test_magicGlobalsPath   s'    
 	J0J)>?r   c                     | j                  dt        j                         | j                  d       | j                  dt        j                         y)z
        Use of the C{__module__} magic builtin should not emit an undefined
        name warning if used in class scope.
        
__module__z3
        class Foo:
            __module__
        zR
        class Foo:
            def bar(self):
                __module__
        Nr   r   s    r   test_magicModuleInClassScopez!Test.test_magicModuleInClassScope   sC    
 	L!//2  	 	  __		r   c                     | j                  dt        j                         | j                  d       | j                  dt        j                         y)z
        Use of the C{__qualname__} magic builtin should not emit an undefined
        name warning if used in class scope.
        __qualname__z5
        class Foo:
            __qualname__
        zT
        class Foo:
            def bar(self):
                __qualname__
        Nr   r   s    r   test_magicQualnameInClassScopez#Test.test_magicQualnameInClassScope
  sC    
 	NAOO4  	 	  __		r   c                 b    | j                  dt        j                  t        j                         y)z)Can't find undefined names with import *.zfrom fu import *; barN)r   r   ImportStarUsedImportStarUsager   s    r   test_globalImportStarzTest.test_globalImportStar  s"    +$$a&7&7	9r   c                 H    | j                  d       | j                  d       y)zd
        "global" can make an otherwise undefined name in another function
        defined.
        z@
        def a(): global fu; fu = 1
        def b(): fu
        zC
        def c(): bar
        def b(): global bar; bar = 1
        Nr   r   s    r   test_definedByGlobalzTest.test_definedByGlobal  s(    
 	  	 	  	r   c                 &    | j                  d       y)z5
        "global" can accept multiple names.
        zS
        def a(): global fu, bar; fu = 1; bar = 2
        def b(): fu; bar
        Nr   r   s    r   !test_definedByGlobalMultipleNamesz&Test.test_definedByGlobalMultipleNames-  s     	  	r   c                 D    | j                  dt        j                         y)zD
        A global statement in the global scope is ignored.
        zB
        global x
        def foo():
            print(x)
        Nr   r   s    r   test_globalInGlobalScopezTest.test_globalInGlobalScope6  s     	  __		r   c                 D    | j                  dt        j                         y)z@A global statement does not prevent other names being undefined.zQ
        def f1():
            s

        def f2():
            global m
        Nr   r   s    r   test_global_reset_name_onlyz Test.test_global_reset_name_only@  s     	  __	r   todoc                 D    | j                  dt        j                         y)z4An unused global statement does not define the name.zQ
        def f1():
            m

        def f2():
            global m
        Nr   r   s    r   test_unused_globalzTest.test_unused_globalL  s     	  __	r   c                 D    | j                  dt        j                         y)zDel deletes bindings.za = 1; del a; aNr   r   s    r   test_delzTest.test_delW  s    %q7r   c                 &    | j                  d       y)z%Del a global binding from a function.zY
        a = 1
        def f():
            global a
            del a
        a
        Nr   r   s    r   test_delGlobalzTest.test_delGlobal[  s      	r   c                 D    | j                  dt        j                         y)zDel an undefined name.zdel aNr   r   s    r   test_delUndefinedzTest.test_delUndefinede  s    GQ__-r   c                 &    | j                  d       y)z8
        Ignores conditional bindings deletion.
        zq
        context = None
        test = True
        if False:
            del(test)
        assert(test)
        Nr   r   s    r   test_delConditionalzTest.test_delConditionali  s     	  	r   c                 &    | j                  d       y)zh
        Ignored conditional bindings deletion even if they are nested in other
        blocks.
        z
        context = None
        test = True
        if False:
            with context():
                del(test)
        assert(test)
        Nr   r   s    r   test_delConditionalNestedzTest.test_delConditionalNestedu  s    
 	  	r   c                 &    | j                  d       y)zb
        Ignore bindings deletion if called inside the body of a while
        statement.
        z~
        def test():
            foo = 'bar'
            while False:
                del foo
            assert(foo)
        Nr   r   s    r   test_delWhilezTest.test_delWhile  r   r   c                 &    | j                  d       y)z
        Ignore bindings deletion if called inside the body of a while
        statement and name is used inside while's test part.
        z
        def _worker():
            o = True
            while o is not True:
                del o
                o = False
        Nr   r   s    r   test_delWhileTestUsagezTest.test_delWhileTestUsage  r   r   c                 &    | j                  d       y)zx
        Ignore bindings deletions if node is part of while's test, even when
        del is in a nested block.
        z
        context = None
        def _worker():
            o = True
            while o is not True:
                while True:
                    with context():
                        del o
                o = False
        Nr   r   s    r   test_delWhileNestedzTest.test_delWhileNested  s    
 	 	 		r   c                 &    | j                  d       y)z.Global names are available from nested scopes.zO
        a = 1
        def b():
            def c():
                a
        Nr   r   s    r   test_globalFromNestedScopezTest.test_globalFromNestedScope  r*   r   c                 D    | j                  dt        j                         y)z~
        Test that referencing a local name that shadows a global, before it is
        defined, generates a warning.
        z_
        a = 1
        def fun():
            a
            a = 2
            return a
        Nr.   r   s    r   (test_laterRedefinedGlobalFromNestedScopez-Test.test_laterRedefinedGlobalFromNestedScope  s     
 	  	r   c                 D    | j                  dt        j                         y)z
        Test that referencing a local name in a nested scope that shadows a
        global declared in an enclosing scope, before it is defined, generates
        a warning.
        z
            a = 1
            def fun():
                global a
                def fun2():
                    a
                    a = 2
                    return a
        Nr.   r   s    r   )test_laterRedefinedGlobalFromNestedScope2z.Test.test_laterRedefinedGlobalFromNestedScope2  s      	  	r   c                 D    | j                  dt        j                         y)a  
        If a name defined in an enclosing scope is shadowed by a local variable
        and the name is used locally before it is bound, an unbound local
        warning is emitted, even if there is a class scope between the enclosing
        scope and the local scope.
        z
        def f():
            x = 1
            class g:
                def h(self):
                    a = x
                    x = None
                    print(x, a)
            print(x)
        Nr.   r   s    r   "test_intermediateClassScopeIgnoredz'Test.test_intermediateClassScopeIgnored  s      	 	 		r   c                     | j                  dt        j                        j                  d   }| j                  rdnd}| j                  |j                  d|f       y)a  
        Test that referencing a local name in a nested scope that shadows a
        variable declared in two different outer scopes before it is defined
        in the innermost scope generates an UnboundLocal warning which
        refers to the nearest shadowed name.
        a  
            def a():
                x = 1
                def b():
                    x = 2 # line 5
                    def c():
                        x
                        x = 3
                        return x
                    return x
                return x
        r         xN)r   r   r/   r   withDoctestassertEqualmessage_args)r   excexpected_line_nums      r   $test_doubleNestingReportsClosestNamez)Test.test_doubleNestingReportsClosestName  s^     kk    (x+ "&!1!1Aq))C1B+CDr   c                 D    | j                  dt        j                         y)z
        Test that referencing a local name in a nested scope that shadows a
        global, before it is defined, generates a warning.
        z
            def fun():
                a = 1
                def fun2():
                    a
                    a = 1
                    return a
                return a
        Nr.   r   s    r   )test_laterRedefinedGlobalFromNestedScope3z.Test.test_laterRedefinedGlobalFromNestedScope3  r'   r   c                     | j                  dt        j                  t        j                  t        j                  t        j                  t        j                         y )Nz
            def f(seq):
                a = 0
                seq[a] += 1
                seq[b] /= 2
                c[0] *= 2
                a -= 3
                d += 4
                e[any] = 5
            r   r   s    r   !test_undefinedAugmentedAssignmentz&Test.test_undefinedAugmentedAssignment  s9    	 OOOOOOQ--OO	
r   c                 &    | j                  d       y)z*Nested classes can access enclosing scope.z
        def f(foo):
            class C:
                bar = foo
                def f(self):
                    return foo
            return C()

        f(123).f()
        Nr   r   s    r   test_nestedClasszTest.test_nestedClass  s     	 		r   c                 D    | j                  dt        j                         y)z=Free variables in nested classes must bind at class creation.z
        def f():
            class C:
                bar = foo
            foo = 456
            return foo
        f()
        Nr   r   s    r   test_badNestedClasszTest.test_badNestedClass,  s      __	r   c                 &    | j                  d       y)z+Star and double-star arg names are defined.z?
        def f(a, *b, **c):
            print(a, b, c)
        Nr   r   s    r   test_definedAsStarArgszTest.test_definedAsStarArgs7  s      	r   c                 j    | j                  d       | j                  d       | j                  d       y)z!Star names in unpack are defined.z7
        a, *b = range(10)
        print(a, b)
        z7
        *a, b = range(10)
        print(a, b)
        z=
        a, *b, c = range(10)
        print(a, b, c)
        Nr   r   s    r   test_definedAsStarUnpackzTest.test_definedAsStarUnpack>  s9      	 	  	 	  	r   c                 j    | j                  d       | j                  d       | j                  d       y)zS
        Star names in unpack are used if RHS is not a tuple/list literal.
        z8
        def f():
            a, *b = range(10)
        z:
        def f():
            (*a, b) = range(10)
        z=
        def f():
            [a, *b, c] = range(10)
        Nr   r   s    r   test_usedAsStarUnpackzTest.test_usedAsStarUnpackM  s;     	  	 	  	 	  	r   c                 <   | j                  dt        j                  t        j                         | j                  dt        j                  t        j                         | j                  dt        j                  t        j                  t        j                         y)zQ
        Star names in unpack are unused if RHS is a tuple/list literal.
        zC
        def f():
            a, *b = any, all, 4, 2, 'un'
        zL
        def f():
            (*a, b) = [bool, int, float, complex]
        zD
        def f():
            [a, *b, c] = 9, 8, 7, 6, 5, 4
        Nr%   r   s    r   test_unusedAsStarUnpackzTest.test_unusedAsStarUnpack^  s}     	  q//	1 	  q//	1 	  q//1A1A	Cr   c                 H    | j                  d       | j                  d       y)z#Keyword-only arg names are defined.z>
        def f(*, a, b=None):
            print(a, b)
        z\
        import default_b
        def f(*, a, b=default_b):
            print(a, b)
        Nr   r   s    r   test_keywordOnlyArgszTest.test_keywordOnlyArgso  s&      	
 	  	r   c                 D    | j                  dt        j                         y)zTypo in kwonly name.zC
        def f(*, a, b=default_c):
            print(a, b)
        Nr   r   s    r   test_keywordOnlyArgsUndefinedz"Test.test_keywordOnlyArgsUndefined|  s      __	r   c                 H    | j                  d       | j                  d       y)zUndefined annotations.z
        from abc import note1, note2, note3, note4, note5
        def func(a: note1, *args: note2,
                 b: note3=12, **kw: note4) -> note5: pass
        zk
        def func():
            d = e = 42
            def func(a: {1, d}) -> (lambda c: e): pass
        Nr   r   s    r   test_annotationUndefinedzTest.test_annotationUndefined  s&      	 	  	r   c                 &    | j                  d       y )NzR
        from abc import ABCMeta
        class A(metaclass=ABCMeta): pass
        r   r   s    r   test_metaClassUndefinedzTest.test_metaClassUndefined  s      	r   c                 H    | j                  d       | j                  d       y)zc
        Using the loop variable of a generator expression results in no
        warnings.
        z(a for a in [1, 2, 3] if a)z-(b for b in (a for a in [1, 2, 3] if a) if b)Nr   r   s    r   test_definedInGenExpzTest.test_definedInGenExp  s    
 	12CDr   c                     | j                  dt        j                         | j                  dt        j                         y)z}
        The loop variables of generator expressions nested together are
        not defined in the other generator.
        z-(b for b in (a for a in [1, 2, 3] if b) if b)z-(b for b in (a for a in [1, 2, 3] if a) if a)Nr   r   s    r   test_undefinedInGenExpNestedz!Test.test_undefinedInGenExpNested  s2    
 	COO	% 	COO	%r   c                     | j                  d       | j                  d       | j                  dt        j                         | j                  dt        j                         y)zr
        Some compatibility code checks explicitly for NameError.
        It should not trigger warnings.
        zc
        try:
            socket_map
        except NameError:
            socket_map = {}
        z
        try:
            _memoryview.contiguous
        except (NameError, AttributeError):
            raise RuntimeError("Python >= 3.3 is required")
        zY
        try:
            socket_map
        except:
            socket_map = {}
        zc
        try:
            socket_map
        except Exception:
            socket_map = {}
        Nr   r   s    r   test_undefinedWithErrorHandlerz#Test.test_undefinedWithErrorHandler  s`    
 	  	 	  	 	 
 __	 	 
 __	r   c                 H    | j                  d       | j                  d       y)zT
        Defined name for generator expressions and dict/set comprehension.
        z
        class A:
            T = range(10)

            Z = (x for x in T)
            L = [x for x in T]
            B = dict((i, str(i)) for i in T)
        zu
        class A:
            T = range(10)

            X = {x for x in T}
            Y = {x:x for x in T}
        Nr   r   s    r   test_definedInClasszTest.test_definedInClass  s(     	  	 	  	r   c                 &    | j                  d       y)z9Defined name for nested generator expressions in a class.za
        class A:
            T = range(10)

            Z = (x for x in (a for a in T))
        Nr   r   s    r   test_definedInClassNestedzTest.test_definedInClassNested  r*   r   c                     | j                  dt        j                         | j                  dt        j                         | j                  dt        j                         y)zP
        The loop variable is defined after the expression is computed.
        z9
        for i in range(i):
            print(i)
        z(
        [42 for i in range(i)]
        z(
        (42 for i in range(i))
        Nr   r   s    r   test_undefinedInLoopzTest.test_undefinedInLoop  sR     	  __	 	 __	 	 __	r   c                 &    | j                  d       y)zi
        Defined name referenced from a lambda function within a dict/set
        comprehension.
        z4
        {lambda: id(x) for x in range(10)}
        Nr   r   s    r   /test_definedFromLambdaInDictionaryComprehensionz4Test.test_definedFromLambdaInDictionaryComprehension      
 	  	r   c                 &    | j                  d       y)zg
        Defined name referenced from a lambda function within a generator
        expression.
        z7
        any(lambda: id(x) for x in range(10))
        Nr   r   s    r   !test_definedFromLambdaInGeneratorz&Test.test_definedFromLambdaInGenerator   r   r   c                 D    | j                  dt        j                         y)zk
        Undefined name referenced from a lambda function within a dict/set
        comprehension.
        z4
        {lambda: id(y) for x in range(10)}
        Nr   r   s    r   1test_undefinedFromLambdaInDictionaryComprehensionz6Test.test_undefinedFromLambdaInDictionaryComprehension	      
 	 __	r   c                 D    | j                  dt        j                         y)zi
        Undefined name referenced from a lambda function within a generator
        expression.
        z7
        any(lambda: id(y) for x in range(10))
        Nr   r   s    r   'test_undefinedFromLambdaInComprehensionz,Test.test_undefinedFromLambdaInComprehension  r   r   c                 *    d}| j                  |       y )Nz
        class Test(object):
            def __init__(self):
                print(__class__.__name__)
                self.x = 1

        t = Test()
        r   )r   codes     r   test_dunderClasszTest.test_dunderClass  s     	Dr   N)FrJ   rQ   rT   r   r   r   r   r   r   r!   r#   r&   r)   r,   r0   r2   r4   r6   r8   r:   r=   rA   rD   rH   rK   rO   rR   rU   rY   r[   r]   r_   ra   rd   rf   rh   rj   rl   rn   rp   rr   rt   rv   rx   rz   r|   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r   r   r   r      s   ,3%
0 

AB% C% 0$ 

AB& C&" 

AB& C&("(!$' $ @  9

 
&\ 8.
  $E2
$	"C"E	%>*	r   r   c                       e Zd ZdZd Zy)	NameTestsz6
    Tests for some extra cases of name handling.
    c                     t        j                  d      }t               |j                  d   j                  d   _        | j                  t        t        j                  |       y)zj
        A Name node with an unrecognized context results in a RuntimeError being
        raised.
        zx = 10r   N)
astparseobjectbodytargetsctxassertRaisesRuntimeErrorr   Checker)r   trees     r   test_impossibleContextz NameTests.test_impossibleContext+  sE    
 yy"&,h		!Q#,>r   N)rJ   rQ   rT   __doc__r   r   r   r   r   r   '  s    ?r   r   )
r   pyflakesr   r   r   pyflakes.test.harnessr   r   r   r   r   r   r   <module>r      s)    
 + 0]8 ]@? ?r   