o
    h                     @   s   d Z ddlmZ ddlmZ ddlmZmZm	Z	 G dd deZ
G dd deZG d	d
 d
eZG dd deZG dd deZdS )z&
Tests for various Pyflakes behavior.
    )version_info)messages)TestCaseskipskipIfc                   @   s  e Zd Zdd Zdd Zdd Zdd Zd	d
 Zdd Zdd Z	dd Z
dd Zdd Zdd Zdd Zdd Zdd Zdd Zdd  Zd!d" Zd#d$ Zd%d& Zd'd( Zd)d* Zd+d, Zd-d. Zd/d0 Zd1d2 Zd3d4 Zd5d6 Zd7d8 Zd9d: Zd;d< Z d=d> Z!d?d@ Z"dAdB Z#dCdD Z$dEdF Z%dGdH Z&dIdJ Z'dKdL Z(dMdN Z)e*dOdPdQ Z+dRdS Z,dTdU Z-dVdW Z.dXdY Z/dZd[ Z0d\d] Z1d^d_ Z2d`da Z3dbdc Z4ddde Z5dfdg Z6dhdi Z7djdk Z8dlS )mTestc                 C      |  dtj d S )Nzdef fu(bar, bar): pass)flakesmDuplicateArgumentself r   N/var/www/html/ai/venv/lib/python3.10/site-packages/pyflakes/test/test_other.pytest_duplicateArgs   s   zTest.test_duplicateArgsc                 C   s   |  dtjtj d S )NzG
        a = 1
        def f():
            a; a=1
        f()
        )r	   r
   UndefinedLocalUnusedVariabler   r   r   r   $test_localReferencedBeforeAssignment   s   z)Test.test_localReferencedBeforeAssignmentc                 C   :   |  d |  d |  dtj |  d |  d dS )z_
        Test that reusing a variable in a generator does not raise
        a warning.
        z8
        a = 1
        (1 for a, b in [(1, 2)])
        zU
        class A:
            a = 1
            list(1 for a, b in [(1, 2)])
        zQ
        def f():
            a = 1
            (1 for a, b in [(1, 2)])
        zK
        (1 for a, b in [(1, 2)])
        (1 for a, b in [(1, 2)])
        zY
        for a, b in [(1, 2)]:
            pass
        (1 for a, b in [(1, 2)])
        Nr	   r
   r   r   r   r   r   test_redefinedInGenerator      


zTest.test_redefinedInGeneratorc                 C   r   )zg
        Test that reusing a variable in a set comprehension does not raise
        a warning.
        z8
        a = 1
        {1 for a, b in [(1, 2)]}
        zQ
        class A:
            a = 1
            {1 for a, b in [(1, 2)]}
        zQ
        def f():
            a = 1
            {1 for a, b in [(1, 2)]}
        zK
        {1 for a, b in [(1, 2)]}
        {1 for a, b in [(1, 2)]}
        zY
        for a, b in [(1, 2)]:
            pass
        {1 for a, b in [(1, 2)]}
        Nr   r   r   r   r    test_redefinedInSetComprehension5   r   z%Test.test_redefinedInSetComprehensionc                 C   r   )zh
        Test that reusing a variable in a dict comprehension does not raise
        a warning.
        z<
        a = 1
        {1: 42 for a, b in [(1, 2)]}
        zU
        class A:
            a = 1
            {1: 42 for a, b in [(1, 2)]}
        zU
        def f():
            a = 1
            {1: 42 for a, b in [(1, 2)]}
        zS
        {1: 42 for a, b in [(1, 2)]}
        {1: 42 for a, b in [(1, 2)]}
        z]
        for a, b in [(1, 2)]:
            pass
        {1: 42 for a, b in [(1, 2)]}
        Nr   r   r   r   r   !test_redefinedInDictComprehensionR   r   z&Test.test_redefinedInDictComprehensionc                 C      |  dtj dS )zf
        Test that shadowing a function definition with another one raises a
        warning.
        z5
        def a(): pass
        def a(): pass
        Nr	   r
   RedefinedWhileUnusedr   r   r   r   test_redefinedFunctiono      zTest.test_redefinedFunctionc                 C   r   )Nz-
        x = 1
        def x(): pass
        r   r   r   r   r   (test_redefined_function_shadows_variabley      z-Test.test_redefined_function_shadows_variablec                 C      |  d dS )zq
        Test that shadowing a function definition named with underscore doesn't
        raise anything.
        z5
        def _(): pass
        def _(): pass
        Nr	   r   r   r   r    test_redefinedUnderscoreFunction      z%Test.test_redefinedUnderscoreFunctionc                 C   r   )zQ
        Test that shadowing an underscore importation raises a warning.
        z;
        from .i18n import _
        def _(): pass
        Nr   r   r   r   r   #test_redefinedUnderscoreImportation      z(Test.test_redefinedUnderscoreImportationc                 C   r   )zw
        Test that shadowing a function definition in a class suite with another
        one raises a warning.
        zN
        class A:
            def a(): pass
            def a(): pass
        Nr   r   r   r   r   test_redefinedClassFunction      z Test.test_redefinedClassFunctionc                 C   r!   )z{
        Test that shadowing a function definition twice in an if
        and else block does not raise a warning.
        z\
        if True:
            def a(): pass
        else:
            def a(): pass
        Nr"   r   r   r   r   test_redefinedIfElseFunction   r$   z!Test.test_redefinedIfElseFunctionc                 C   r   )zh
        Test that shadowing a function definition within an if block
        raises a warning.
        zN
        if True:
            def a(): pass
            def a(): pass
        Nr   r   r   r   r   test_redefinedIfFunction   r(   zTest.test_redefinedIfFunctionc                 C   r!   )z{
        Test that shadowing a function definition twice in try
        and except block does not raise a warning.
        zZ
        try:
            def a(): pass
        except:
            def a(): pass
        Nr"   r   r   r   r   test_redefinedTryExceptFunction   r$   z$Test.test_redefinedTryExceptFunctionc                 C   r   )zh
        Test that shadowing a function definition within a try block
        raises a warning.
        zk
        try:
            def a(): pass
            def a(): pass
        except:
            pass
        Nr   r   r   r   r   test_redefinedTryFunction   s   zTest.test_redefinedTryFunctionc                 C   r!   )z
        Test that shadowing a variable in a list comprehension in
        an if and else block does not raise a warning.
        zY
        if False:
            a = 1
        else:
            [a for a in '12']
        Nr"   r   r   r   r   test_redefinedIfElseInListComp   r$   z#Test.test_redefinedIfElseInListCompc                 C   r!   )z
        Test that shadowing a function definition with a decorated version of
        that function does not raise a warning.
        zi
        from somewhere import somedecorator

        def a(): pass
        a = somedecorator(a)
        Nr"   r   r   r   r   test_functionDecorator   r$   zTest.test_functionDecoratorc                 C   r!   )z
        Test that shadowing a function definition in a class suite with a
        decorated version of that function does not raise a warning.
        zS
        class A:
            def a(): pass
            a = classmethod(a)
        Nr"   r   r   r   r   test_classFunctionDecorator   r$   z Test.test_classFunctionDecoratorc                 C      |  d d S )Nz
        class A:
            @property
            def t(self):
                pass
            @t.setter
            def t(self, value):
                pass
            @t.deleter
            def t(self):
                pass
        r"   r   r   r   r   test_modernProperty      zTest.test_modernPropertyc                 C   r!   )zDon't die on unary +.z+1Nr"   r   r   r   r   test_unaryPlus      zTest.test_unaryPlusc                 C   r   )zn
        If a name in the base list of a class definition is undefined, a
        warning is emitted.
        z2
        class foo(foo):
            pass
        Nr	   r
   UndefinedNamer   r   r   r   test_undefinedBaseClass  r   zTest.test_undefinedBaseClassc                 C   r   )z
        If a class name is used in the body of that class's definition and
        the name is not already defined, a warning is emitted.
        z,
        class foo:
            foo
        Nr5   r   r   r   r   "test_classNameUndefinedInClassBody  r   z'Test.test_classNameUndefinedInClassBodyc                 C   r!   )z
        If a class name is used in the body of that class's definition and
        the name was previously defined in some other way, no warning is
        emitted.
        z?
        foo = None
        class foo:
            foo
        Nr"   r   r   r   r   test_classNameDefinedPreviously     z$Test.test_classNameDefinedPreviouslyc                 C   r   )zW
        If a class is defined twice in the same module, a warning is emitted.
        zQ
        class Foo:
            pass
        class Foo:
            pass
        Nr   r   r   r   r   test_classRedefinition"     zTest.test_classRedefinitionc                 C   r   )zN
        If a function is redefined as a class, a warning is emitted.
        zQ
        def Foo():
            pass
        class Foo:
            pass
        Nr   r   r   r   r   test_functionRedefinedAsClass-  r<   z"Test.test_functionRedefinedAsClassc                 C   r   )zN
        If a class is redefined as a function, a warning is emitted.
        zQ
        class Foo:
            pass
        def Foo():
            pass
        Nr   r   r   r   r   test_classRedefinedAsFunction8  r<   z"Test.test_classRedefinedAsFunctionc                 C   r   )zK
        If a return is used inside a class, a warning is emitted.
        z7
        class Foo(object):
            return
        Nr	   r
   ReturnOutsideFunctionr   r   r   r   test_classWithReturnC  r&   zTest.test_classWithReturnc                 C   r   )zP
        If a return is used at the module level, a warning is emitted.
        z
        return
        Nr?   r   r   r   r   test_moduleWithReturnL     zTest.test_moduleWithReturnc                 C   r   )zJ
        If a yield is used inside a class, a warning is emitted.
        z6
        class Foo(object):
            yield
        Nr	   r
   YieldOutsideFunctionr   r   r   r   test_classWithYieldT  r&   zTest.test_classWithYieldc                 C   r   )zO
        If a yield is used at the module level, a warning is emitted.
        z
        yield
        NrD   r   r   r   r   test_moduleWithYield]  rC   zTest.test_moduleWithYieldc                 C   r   )zO
        If a yield from is used inside a class, a warning is emitted.
        zE
        class Foo(object):
            yield from range(10)
        NrD   r   r   r   r   test_classWithYieldFrome  r&   zTest.test_classWithYieldFromc                 C   r   )zT
        If a yield from is used at the module level, a warning is emitted.
        z&
        yield from range(10)
        NrD   r   r   r   r   test_moduleWithYieldFromn  rC   zTest.test_moduleWithYieldFromc                 C   sX   |  dtj |  dtj |  dtj |  dtj |  dtj |  dtj d S )Nz
        continue
        z/
        def f():
            continue
        zQ
        while True:
            pass
        else:
            continue
        z
        while True:
            pass
        else:
            if 1:
                if 2:
                    continue
        zK
        while True:
            def f():
                continue
        zK
        while True:
            class A:
                continue
        )r	   r
   ContinueOutsideLoopr   r   r   r   test_continueOutsideLoopv  s$   	zTest.test_continueOutsideLoopc                 C   s@   |  d |  d |  d |  d |  d |  d d S )Nz2
        while True:
            continue
        z:
        for i in range(10):
            continue
        zH
        while True:
            if 1:
                continue
        zP
        for i in range(10):
            if 1:
                continue
        z
        while True:
            while True:
                pass
            else:
                continue
        else:
            pass
        z
        while True:
            try:
                pass
            finally:
                while True:
                    continue
        r"   r   r   r   r   test_continueInsideLoop  s   





zTest.test_continueInsideLoopc                 C   sf   |  dtj |  dtj |  dtj |  dtj |  dtj |  dtj |  dtj d S )Nz
        break
        z,
        def f():
            break
        zN
        while True:
            pass
        else:
            break
        z~
        while True:
            pass
        else:
            if 1:
                if 2:
                    break
        zH
        while True:
            def f():
                break
        zH
        while True:
            class A:
                break
        zJ
        try:
            pass
        finally:
            break
        )r	   r
   BreakOutsideLoopr   r   r   r   test_breakOutsideLoop  s*   	zTest.test_breakOutsideLoopc                 C   sT   |  d |  d |  d |  d |  d |  d |  d |  d d S )	Nz/
        while True:
            break
        z7
        for i in range(10):
            break
        zE
        while True:
            if 1:
                break
        zM
        for i in range(10):
            if 1:
                break
        z
        while True:
            while True:
                pass
            else:
                break
        else:
            pass
        z
        while True:
            try:
                pass
            finally:
                while True:
                    break
        zn
        while True:
            try:
                pass
            finally:
                break
        z
        while True:
            try:
                pass
            finally:
                if 1:
                    if 2:
                        break
        r"   r   r   r   r   test_breakInsideLoop  s   







	zTest.test_breakInsideLoopc                 C   s@   |  d |  d |  d |  d |  d |  d dS )a#  
        A default except block should be last.

        YES:

        try:
            ...
        except Exception:
            ...
        except:
            ...

        NO:

        try:
            ...
        except:
            ...
        except Exception:
            ...
        zS
        try:
            pass
        except ValueError:
            pass
        zt
        try:
            pass
        except ValueError:
            pass
        except:
            pass
        zH
        try:
            pass
        except:
            pass
        zr
        try:
            pass
        except ValueError:
            pass
        else:
            pass
        zg
        try:
            pass
        except:
            pass
        else:
            pass
        z
        try:
            pass
        except ValueError:
            pass
        except:
            pass
        else:
            pass
        Nr"   r   r   r   r   test_defaultExceptLast/  s   


	

		zTest.test_defaultExceptLastc                 C   s   |  dtj |  dtj |  dtj |  dtjtj |  dtj |  dtj |  dtj |  dtjtj |  d	tj |  d
tj |  dtj |  dtjtj |  dtj |  dtj |  dtj |  dtjtj d S )Nzt
        try:
            pass
        except:
            pass
        except ValueError:
            pass
        zi
        try:
            pass
        except:
            pass
        except:
            pass
        z
        try:
            pass
        except:
            pass
        except ValueError:
            pass
        except:
            pass
        z
        try:
            pass
        except:
            pass
        except ValueError:
            pass
        except:
            pass
        except ValueError:
            pass
        z
        try:
            pass
        except:
            pass
        except ValueError:
            pass
        else:
            pass
        z
        try:
            pass
        except:
            pass
        except:
            pass
        else:
            pass
        z
        try:
            pass
        except:
            pass
        except ValueError:
            pass
        except:
            pass
        else:
            pass
        z
        try:
            pass
        except:
            pass
        except ValueError:
            pass
        except:
            pass
        except ValueError:
            pass
        else:
            pass
        z
        try:
            pass
        except:
            pass
        except ValueError:
            pass
        finally:
            pass
        z
        try:
            pass
        except:
            pass
        except:
            pass
        finally:
            pass
        z
        try:
            pass
        except:
            pass
        except ValueError:
            pass
        except:
            pass
        finally:
            pass
        z
        try:
            pass
        except:
            pass
        except ValueError:
            pass
        except:
            pass
        except ValueError:
            pass
        finally:
            pass
        z
        try:
            pass
        except:
            pass
        except ValueError:
            pass
        else:
            pass
        finally:
            pass
        z
        try:
            pass
        except:
            pass
        except:
            pass
        else:
            pass
        finally:
            pass
        z
        try:
            pass
        except:
            pass
        except ValueError:
            pass
        except:
            pass
        else:
            pass
        finally:
            pass
        a  
        try:
            pass
        except:
            pass
        except ValueError:
            pass
        except:
            pass
        except ValueError:
            pass
        else:
            pass
        finally:
            pass
        )r	   r
   DefaultExceptNotLastr   r   r   r   test_defaultExceptNotLasty  s`   							zTest.test_defaultExceptNotLastc                 C   s   |  d |  d |  d |  d |  d |  d |  d |  d |  d	 d
dd tdD d }|  | dd
dd tdD  d }|  | dd
dd tdD  d }|  | dS )z6
        Python 3 extended iterable unpacking
        z#
        a, *b = range(10)
        z#
        *a, b = range(10)
        z&
        a, *b, c = range(10)
        z%
        (a, *b) = range(10)
        z%
        (*a, b) = range(10)
        z(
        (a, *b, c) = range(10)
        z%
        [a, *b] = range(10)
        z%
        [*a, b] = range(10)
        z(
        [a, *b, c] = range(10)
        , c                 s       | ]}d | V  qdS za%dNr   .0ir   r   r   	<genexpr>k      z5Test.test_starredAssignmentNoError.<locals>.<genexpr>   z, *rest = range(1<<8)(c                 s   rT   rU   r   rV   r   r   r   rY   o  rZ   z, *rest) = range(1<<8)[c                 s   rT   rU   r   rV   r   r   r   rY   s  rZ   z, *rest] = range(1<<8)N)r	   joinranger   sr   r   r   test_starredAssignmentNoErrorB  s*   










z"Test.test_starredAssignmentNoErrorc                 C   s  d dd tdD d }| |tj dd dd tdD  d }| |tj d	d d
d tdD  d }| |tj d dd tdD d }| |tj dd dd tdD  d }| |tj d	d dd tdD  d }| |tj | dtj | dtj | dtj | dtj | dtj | dtj | dtj | dtj | dtj dS )zp
        SyntaxErrors (not encoded in the ast) surrounding Python 3 extended
        iterable unpacking
        rS   c                 s   rT   rU   r   rV   r   r   r   rY   }  rZ   z4Test.test_starredAssignmentErrors.<locals>.<genexpr>   z, *rest = range(1<<8 + 1)r\   c                 s   rT   rU   r   rV   r   r   r   rY     rZ   z, *rest) = range(1<<8 + 1)r]   c                 s   rT   rU   r   rV   r   r   r   rY     rZ   z, *rest] = range(1<<8 + 1)c                 s   rT   rU   r   rV   r   r   r   rY     rZ   i   z, *rest = range(1<<8 + 2)c                 s   rT   rU   r   rV   r   r   r   rY     rZ   z, *rest) = range(1<<8 + 2)c                 s   rT   rU   r   rV   r   r   r   rY     rZ   z, *rest] = range(1<<8 + 2)z'
        a, *b, *c = range(10)
        z*
        a, *b, c, *d = range(10)
        z(
        *a, *b, *c = range(10)
        z)
        (a, *b, *c) = range(10)
        z,
        (a, *b, c, *d) = range(10)
        z*
        (*a, *b, *c) = range(10)
        z)
        [a, *b, *c] = range(10)
        z,
        [a, *b, c, *d] = range(10)
        z*
        [*a, *b, *c] = range(10)
        N)r^   r_   r	   r
   %TooManyExpressionsInStarredAssignmentTwoStarredExpressionsr`   r   r   r   test_starredAssignmentErrorsw  sf   z!Test.test_starredAssignmentErrorsz<todo: Too hard to make this warn but other cases stay silentc                 C   r   )zd
        If a variable is re-assigned to without being used, no warning is
        emitted.
        z'
        x = 10
        x = 20
        Nr   r   r   r   r   test_doubleAssignment  s   zTest.test_doubleAssignmentc                 C   r!   )zc
        If a variable is re-assigned within a conditional, no warning is
        emitted.
        z<
        x = 10
        if True:
            x = 20
        Nr"   r   r   r   r   "test_doubleAssignmentConditionally  r$   z'Test.test_doubleAssignmentConditionallyc                 C   r!   )zb
        If a variable is re-assigned to after being used, no warning is
        emitted.
        z9
        x = 10
        y = x * 2
        x = 20
        Nr"   r   r   r   r   test_doubleAssignmentWithUse  r$   z!Test.test_doubleAssignmentWithUsec                 C   r!   )z
        If a defined name is used on either side of any of the six comparison
        operators, no warning is emitted.
        z
        x = 10
        y = 20
        x < y
        x <= y
        x == y
        x != y
        x >= y
        x > y
        Nr"   r   r   r   r   test_comparison  r$   zTest.test_comparisonc                 C   r!   )zn
        If a defined name is used on either side of an identity test, no
        warning is emitted.
        zI
        x = 10
        y = 20
        x is y
        x is not y
        Nr"   r   r   r   r   test_identity  r$   zTest.test_identityc                 C   r!   )zp
        If a defined name is used on either side of a containment test, no
        warning is emitted.
        zI
        x = 10
        y = 20
        x in y
        x not in y
        Nr"   r   r   r   r   test_containment  r$   zTest.test_containmentc                 C   s   |  d |  d dS )z>
        break and continue statements are supported.
        z4
        for x in [1, 2]:
            break
        z7
        for x in [1, 2]:
            continue
        Nr"   r   r   r   r   test_loopControl  s   
zTest.test_loopControlc                 C   r!   )z3
        Ellipsis in a slice is supported.
        z
        [1, 2][...]
        Nr"   r   r   r   r   test_ellipsis     zTest.test_ellipsisc                 C   r!   )z0
        Extended slices are supported.
        z+
        x = 3
        [1, 2][x,:]
        Nr"   r   r   r   r   test_extendedSlice  ro   zTest.test_extendedSlicec                 C   r!   )zh
        Augmented assignment of a variable is supported.
        We don't care about var refs.
        z*
        foo = 0
        foo += 1
        Nr"   r   r   r   r   test_varAugmentedAssignment%  r$   z Test.test_varAugmentedAssignmentc                 C   r!   )zi
        Augmented assignment of attributes is supported.
        We don't care about attr refs.
        z7
        foo = None
        foo.bar += foo.baz
        Nr"   r   r   r   r   test_attrAugmentedAssignment/  r$   z!Test.test_attrAugmentedAssignmentc                 C   r!   )zP
        A 'global' can be declared in one scope and reused in another.
        zV
        def f(): global foo
        def g(): foo = 'anything'; foo.is_used()
        Nr"   r   r   r   r   #test_globalDeclaredInDifferentScope9  ro   z(Test.test_globalDeclaredInDifferentScopec                 C   s,   |  d |  d |  d |  d dS )z;
        Test to traverse ARG and ARGUMENT handler
        z1
        def foo(a, b):
            pass
        z6
        def foo(a, b, c=0):
            pass
        z=
        def foo(a, b, c=0, *args):
            pass
        zG
        def foo(a, b, c=0, *args, **kwargs):
            pass
        Nr"   r   r   r   r   test_function_argumentsB  s   


zTest.test_function_argumentsc                 C   r0   )NzL
        def foo(a, b, c=0, *args, d=0, **kwargs):
            pass
        r"   r   r   r   r   test_function_arguments_python3Z  r2   z$Test.test_function_arguments_python3N)9__name__
__module____qualname__r   r   r   r   r   r   r   r#   r%   r'   r)   r*   r+   r,   r-   r.   r/   r1   r3   r7   r8   r9   r;   r=   r>   rA   rB   rF   rG   rH   rI   rK   rL   rN   rO   rP   rR   rb   rf   r   rg   rh   ri   rj   rk   rl   rm   rn   rp   rq   rr   rs   rt   ru   r   r   r   r   r      sp    

	

			&*-<J J5G

	

	r   c                   @   s  e Zd ZdZdd Zdd Zdd Zdd	 Zed
dd Z	dd Z
dd Zdd Zdd Zdd Zdd Zdd Zdd Zdd Zdd  Zd!d" Zd#d$ Zd%d& Zd'd( Zd)d* Zd+d, Zd-d. Zd/d0 Zd1d2 Zd3d4 Zd5d6 Zd7d8 Zd9d: Z d;d< Z!d=d> Z"d?d@ Z#dAdB Z$dCdD Z%dEdF Z&dGdH Z'dIdJ Z(dKdL Z)dMdN Z*dOdP Z+e,e-dQk dRdSdT Z.dUdV Z/dWdX Z0dYdZ Z1d[d\ Z2d]d^ Z3d_d` Z4dadb Z5dcdd Z6dedf Z7dgdh Z8didj Z9dkdl Z:dmdn Z;dodp Z<dqS )rTestUnusedAssignmentz5
    Tests for warning about unused assignments.
    c                 C   r   )zc
        Warn when a variable in a function is assigned a value that's never
        used.
        z,
        def a():
            b = 1
        Nr   r   r   r   r   test_unusedVariablef  r   z(TestUnusedAssignment.test_unusedVariablec                 C   r!   )zh
        Don't warn when the magic "_" (underscore) variable is unused.
        See issue #202.
        zC
        def a(unused_param):
            _ = unused_param
        Nr"   r   r   r   r   test_unusedUnderscoreVariablep  r$   z2TestUnusedAssignment.test_unusedUnderscoreVariablec                 C   r!   )zO
        Using locals() it is perfectly valid to have unused variables
        zH
        def a():
            b = 1
            return locals()
        Nr"   r   r   r   r   test_unusedVariableAsLocalsz  ro   z0TestUnusedAssignment.test_unusedVariableAsLocalsc                 C   r   )zA
        Using locals() in wrong scope should not matter
        zq
        def a():
            locals()
            def a():
                b = 1
                return
        Nr   r   r   r   r   test_unusedVariableNoLocals  s   z0TestUnusedAssignment.test_unusedVariableNoLocalszAtodo: Difficult because it doesn't apply in the context of a loopc                 C   r   )zV
        Shadowing a used variable can still raise an UnusedVariable warning.
        zR
        def a():
            b = 1
            b.foo()
            b = 2
        Nr   r   r   r   r   test_unusedReassignedVariable  s   z2TestUnusedAssignment.test_unusedReassignedVariablec                 C   r!   )zt
        Shadowing a used variable cannot raise an UnusedVariable warning in the
        context of a loop.
        z^
        def a():
            b = True
            while b:
                b = False
        Nr"   r   r   r   r   test_variableUsedInLoop  r$   z,TestUnusedAssignment.test_variableUsedInLoopc                 C   r!   )z
        Assigning to a global and then not using that global is perfectly
        acceptable. Do not mistake it for an unused local variable.
        zO
        b = 0
        def a():
            global b
            b = 1
        Nr"   r   r   r   r   test_assignToGlobal  r$   z(TestUnusedAssignment.test_assignToGlobalc                 C   r!   )z
        Assigning to a nonlocal and then not using that binding is perfectly
        acceptable. Do not mistake it for an unused local variable.
        zW
        b = b'0'
        def a():
            nonlocal b
            b = b'1'
        Nr"   r   r   r   r   test_assignToNonlocal  r$   z*TestUnusedAssignment.test_assignToNonlocalc                 C   r!   )z
        Assigning to a member of another object and then not using that member
        variable is perfectly acceptable. Do not mistake it for an unused
        local variable.
        zR
        class b:
            pass
        def a():
            b.foo = 1
        Nr"   r   r   r   r   test_assignToMember     z(TestUnusedAssignment.test_assignToMemberc                 C   r!   )zW
        Don't warn when a variable in a for loop is assigned to but not used.
        zO
        def f():
            for i in range(10):
                pass
        Nr"   r   r   r   r   test_assignInForLoop  ro   z)TestUnusedAssignment.test_assignInForLoopc                 C   r!   )zi
        Don't warn when a variable in a list comprehension is
        assigned to but not used.
        z@
        def f():
            [None for i in range(10)]
        Nr"   r   r   r   r   test_assignInListComprehension  r$   z3TestUnusedAssignment.test_assignInListComprehensionc                 C   r!   )zk
        Don't warn when a variable in a generator expression is
        assigned to but not used.
        z@
        def f():
            (None for i in range(10))
        Nr"   r   r   r   r   test_generatorExpression  r$   z-TestUnusedAssignment.test_generatorExpressionc                 C   r!   )zW
        Don't warn when a variable assignment occurs lexically after its use.
        z
        def f():
            x = None
            for i in range(10):
                if i > 2:
                    return x
                x = i * 2
        Nr"   r   r   r   r   test_assignmentInsideLoop  ro   z.TestUnusedAssignment.test_assignmentInsideLoopc                 C   sF   |  d |  dtjtj |  d |  dtj |  dtj dS )z
        Don't warn when a variable included in tuple unpacking is unused. It's
        very common for variables in a tuple unpacking assignment to be unused
        in good Python code, so warning will only create false positives.
        z6
        def f(tup):
            (x, y) = tup
        z4
        def f():
            (x, y) = 1, 2
        zq
        def f():
            (x, y) = coords = 1, 2
            if x > 1:
                print(coords)
        z=
        def f():
            (x, y) = coords = 1, 2
        z=
        def f():
            coords = (x, y) = 1, 2
        Nr   r   r   r   r   test_tupleUnpacking  s   

z(TestUnusedAssignment.test_tupleUnpackingc                 C   s    |  d |  dtjtj dS )zR
        Don't warn when a variable included in list unpacking is unused.
        z6
        def f(tup):
            [x, y] = tup
        z6
        def f():
            [x, y] = [1, 2]
        Nr   r   r   r   r   test_listUnpacking  s   
z'TestUnusedAssignment.test_listUnpackingc                 C   r!   )zN
        Don't warn when the assignment is used in an inner function.
        z~
        def barMaker():
            foo = 5
            def bar():
                return foo
            return bar
        Nr"   r   r   r   r   test_closedOver$  ro   z$TestUnusedAssignment.test_closedOverc                 C   r!   )z
        Don't warn when the assignment is used in an inner function, even if
        that inner function itself is in an inner function.
        z
        def barMaker():
            foo = 5
            def bar():
                def baz():
                    return foo
            return bar
        Nr"   r   r   r   r   test_doubleClosedOver0  r$   z*TestUnusedAssignment.test_doubleClosedOverc                 C   r!   )z}
        Do not warn about unused local variable __tracebackhide__, which is
        a special variable for py.test.
        zL
            def helper():
                __tracebackhide__ = True
        Nr"   r   r   r   r   !test_tracebackhideSpecialVariable>  r$   z6TestUnusedAssignment.test_tracebackhideSpecialVariablec                 C   s*   |  d |  dtj |  dtj dS )z9
        Test C{foo if bar else baz} statements.
        za = 'moo' if True else 'oink'za = foo if True else 'oink'za = 'moo' if True else barNr5   r   r   r   r   
test_ifexpH  s   
zTestUnusedAssignment.test_ifexpc                 C   s4   |  d |  d |  dtj |  dtj dS )z/
        Test C{if (foo,)} conditions.
        zif (): passzC
        if (
            True
        ):
            pass
        zD
        if (
            True,
        ):
            pass
        z?
        x = 1 if (
            True,
        ) else 2
        N)r	   r
   IfTupler   r   r   r   test_if_tupleP  s   

z"TestUnusedAssignment.test_if_tuplec                 C   r!   )z
        No warnings are emitted for using inside or after a nameless C{with}
        statement a name defined beforehand.
        zR
        bar = None
        with open("foo"):
            bar
        bar
        Nr"   r   r   r   r   test_withStatementNoNamesg  r$   z.TestUnusedAssignment.test_withStatementNoNamesc                 C   r!   )z
        No warnings are emitted for using a name defined by a C{with} statement
        within the suite or afterwards.
        zF
        with open('foo') as bar:
            bar
        bar
        Nr"   r   r   r   r   test_withStatementSingleNames  r$   z1TestUnusedAssignment.test_withStatementSingleNamec                 C   r!   )zn
        No warnings are emitted for using an attribute as the target of a
        C{with} statement.
        zR
        import foo
        with open('foo') as foo.bar:
            pass
        Nr"   r   r   r   r   test_withStatementAttributeName~  r$   z4TestUnusedAssignment.test_withStatementAttributeNamec                 C   r!   )zm
        No warnings are emitted for using a subscript as the target of a
        C{with} statement.
        zQ
        import foo
        with open('foo') as foo[0]:
            pass
        Nr"   r   r   r   r   test_withStatementSubscript  r$   z0TestUnusedAssignment.test_withStatementSubscriptc                 C   r   )z
        An undefined name warning is emitted if the subscript used as the
        target of a C{with} statement is not defined.
        zS
        import foo
        with open('foo') as foo[bar]:
            pass
        Nr5   r   r   r   r   $test_withStatementSubscriptUndefined  r(   z9TestUnusedAssignment.test_withStatementSubscriptUndefinedc                 C   r!   )z
        No warnings are emitted for using any of the tuple of names defined by
        a C{with} statement within the suite or afterwards.
        zW
        with open('foo') as (bar, baz):
            bar, baz
        bar, baz
        Nr"   r   r   r   r   test_withStatementTupleNames  r$   z1TestUnusedAssignment.test_withStatementTupleNamesc                 C   r!   )z
        No warnings are emitted for using any of the list of names defined by a
        C{with} statement within the suite or afterwards.
        zW
        with open('foo') as [bar, baz]:
            bar, baz
        bar, baz
        Nr"   r   r   r   r   test_withStatementListNames  r$   z0TestUnusedAssignment.test_withStatementListNamesc                 C   r!   )aq  
        If the target of a C{with} statement uses any or all of the valid forms
        for that part of the grammar (See
        U{http://docs.python.org/reference/compound_stmts.html#the-with-statement}),
        the names involved are checked both for definedness and any bindings
        created are respected in the suite of the statement and afterwards.
        z
        c = d = e = g = h = i = None
        with open('foo') as [(a, b), c[d], e.f, g[h:i]]:
            a, b, c, d, e, g, h, i
        a, b, c, d, e, g, h, i
        Nr"   r   r   r   r   #test_withStatementComplicatedTarget  r   z8TestUnusedAssignment.test_withStatementComplicatedTargetc                 C   r   )z
        An undefined name warning is emitted if the name first defined by a
        C{with} statement is used before the C{with} statement.
        zG
        bar
        with open('foo') as bar:
            pass
        Nr5   r   r   r   r   %test_withStatementSingleNameUndefined  r(   z:TestUnusedAssignment.test_withStatementSingleNameUndefinedc                 C   r   )z
        An undefined name warning is emitted if a name first defined by the
        tuple-unpacking form of the C{with} statement is used before the
        C{with} statement.
        zN
        baz
        with open('foo') as (bar, baz):
            pass
        Nr5   r   r   r   r   %test_withStatementTupleNamesUndefined     z:TestUnusedAssignment.test_withStatementTupleNamesUndefinedc                 C   r   )z
        A redefined name warning is emitted if a name bound by an import is
        rebound by the name defined by a C{with} statement.
        zN
        import bar
        with open('foo') as bar:
            pass
        Nr   r   r   r   r   %test_withStatementSingleNameRedefined  r(   z:TestUnusedAssignment.test_withStatementSingleNameRedefinedc                 C   r   )z
        A redefined name warning is emitted if a name bound by an import is
        rebound by one of the names defined by the tuple-unpacking form of a
        C{with} statement.
        zU
        import bar
        with open('foo') as (bar, baz):
            pass
        Nr   r   r   r   r   %test_withStatementTupleNamesRedefined  r   z:TestUnusedAssignment.test_withStatementTupleNamesRedefinedc                 C   r   )z
        An undefined name warning is emitted if a name is used inside the
        body of a C{with} statement without first being bound.
        z:
        with open('foo') as bar:
            baz
        Nr5   r   r   r   r   !test_withStatementUndefinedInside  r   z6TestUnusedAssignment.test_withStatementUndefinedInsidec                 C   r!   )z|
        A name defined in the body of a C{with} statement can be used after
        the body ends without warning.
        zK
        with open('foo') as bar:
            baz = 10
        baz
        Nr"   r   r   r   r   #test_withStatementNameDefinedInBody  r$   z8TestUnusedAssignment.test_withStatementNameDefinedInBodyc                 C   s    |  dtj |  dtj dS )z
        An undefined name warning is emitted if a name in the I{test}
        expression of a C{with} statement is undefined.
        z3
        with bar as baz:
            pass
        z3
        with bar as bar:
            pass
        Nr5   r   r   r   r   'test_withStatementUndefinedInExpression  s   z<TestUnusedAssignment.test_withStatementUndefinedInExpressionc                 C   r!   )z;
        Dict comprehensions are properly handled.
        z/
        a = {1: x for x in range(10)}
        Nr"   r   r   r   r   test_dictComprehension  ro   z+TestUnusedAssignment.test_dictComprehensionc                 C   r!   )z:
        Set comprehensions are properly handled.
        zB
        a = {1, 2, 3}
        b = {x for x in range(10)}
        Nr"   r   r   r   r   test_setComprehensionAndLiteral  ro   z4TestUnusedAssignment.test_setComprehensionAndLiteralc                 C      |  d |  d d S )Nz<
        try: pass
        except Exception as e: e
        zc
        def download_review():
            try: pass
            except Exception as e: e
        r"   r   r   r   r   test_exceptionUsedInExcept'     
z/TestUnusedAssignment.test_exceptionUsedInExceptc                 C   r   )Nz?
        try: pass
        except Exception as e: pass
        r   r   r   r   r   test_exceptionUnusedInExcept3  r    z1TestUnusedAssignment.test_exceptionUnusedInExcept)      znew in Python 3.11c                 C   r   )Nzf
            try:
                pass
            except* OSError as e:
                pass
        r   r   r   r   r   $test_exception_unused_in_except_star9  s   z9TestUnusedAssignment.test_exception_unused_in_except_starc                 C   r   )Nzf
        def download_review():
            try: pass
            except Exception as e: pass
        r   r   r   r   r   &test_exceptionUnusedInExceptInFunctionB  s   z;TestUnusedAssignment.test_exceptionUnusedInExceptInFunctionc                 C   r!   )z
        Don't issue false warning when an unnamed exception is used.
        Previously, there would be a false warning, but only when the
        try..except was in a function
        zw
        import tokenize
        def foo():
            try: pass
            except tokenize.TokenError: pass
        Nr"   r   r   r   r    test_exceptWithoutNameInFunctionI  r:   z5TestUnusedAssignment.test_exceptWithoutNameInFunctionc                 C   r!   )z
        Don't issue false warning when an unnamed exception is used.
        This example catches a tuple of exception types.
        z
        import tokenize
        def foo():
            try: pass
            except (tokenize.TokenError, IndentationError): pass
        Nr"   r   r   r   r   %test_exceptWithoutNameInFunctionTupleV  r$   z:TestUnusedAssignment.test_exceptWithoutNameInFunctionTuplec                 C   r!   )zt
        Consider a function that is called on the right part of an
        augassign operation to be used.
        zJ
        from foo import bar
        baz = 0
        baz += bar()
        Nr"   r   r   r   r   ,test_augmentedAssignmentImportedFunctionCallb  r$   zATestUnusedAssignment.test_augmentedAssignmentImportedFunctionCallc                 C   r!   )z,An assert without a message is not an error.z(
        a = 1
        assert a
        Nr"   r   r   r   r   test_assert_without_messagem  r4   z0TestUnusedAssignment.test_assert_without_messagec                 C   r!   )z)An assert with a message is not an error.z-
        a = 1
        assert a, 'x'
        Nr"   r   r   r   r   test_assert_with_messaget  r4   z-TestUnusedAssignment.test_assert_with_messagec                 C   s   |  dtjtj dS )z.An assert of a non-empty tuple is always True.z>
        assert (False, 'x')
        assert (False, )
        N)r	   r
   AssertTupler   r   r   r   test_assert_tuple{  s   z&TestUnusedAssignment.test_assert_tuplec                 C   r!   )z,An assert of an empty tuple is always False.z
        assert ()
        Nr"   r   r   r   r   test_assert_tuple_empty  r4   z,TestUnusedAssignment.test_assert_tuple_emptyc                 C   r!   )z,An assert of a static value is not an error.z.
        assert True
        assert 1
        Nr"   r   r   r   r   test_assert_static  r4   z'TestUnusedAssignment.test_assert_staticc                 C   r   )z.
        Test C{yield from} statement
        z9
        def bar():
            yield from foo()
        Nr5   r   r   r   r   test_yieldFromUndefined  r&   z,TestUnusedAssignment.test_yieldFromUndefinedc                 C   r!   )z.Test PEP 498 f-strings are treated as a usage.z3
        baz = 0
        print(f'{4*baz}')
        Nr"   r   r   r   r   test_f_string  r4   z"TestUnusedAssignment.test_f_stringc                 C   r!   )zATest PEP 572 assignment expressions are treated as usage / write.zJ
        from foo import y
        print(x := y)
        print(x)
        Nr"   r   r   r   r   test_assign_expr  r4   z%TestUnusedAssignment.test_assign_exprc                 C   r!   )z5Test assignment expressions in generator expressions.zO
        if (any((y := x[0]) for x in [[True]])):
            print(y)
        Nr"   r   r   r   r    test_assign_expr_generator_scope  r4   z5TestUnusedAssignment.test_assign_expr_generator_scopec                 C   r!   )z2Test assignment expressions in nested expressions.zz
        if ([(y:=x) for x in range(4) if [(z:=q) for q in range(4)]]):
            print(y)
            print(z)
        Nr"   r   r   r   r   test_assign_expr_nested  r4   z,TestUnusedAssignment.test_assign_expr_nestedN)=rv   rw   rx   __doc__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   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   r   r   ry   a  st    








	
	ry   c                   @   s,   e Zd Zdd Zdd Zdd Zdd Zd	S )
TestStringFormattingc                 C   sZ   |  dtj |  dtj |  dtj |  dtj |  d |  d |  d d S )Nzf'foo'z=
            f"""foo
            bar
            """
        zX
            print(
                f'foo'
                f'bar'
            )
        zf'{{}}'z5
            x = 5
            print(f'{x}')
        z?
            x = 'a' * 90
            print(f'{x:.8}')
        zC
            x = y = 5
            print(f'{x:>2} {y:>2}')
        )r	   r
   FStringMissingPlaceholdersr   r   r   r   "test_f_string_without_placeholders  s   

z7TestStringFormatting.test_f_string_without_placeholdersc                 C   s   |  dtj |  dtj |  dtj |  dtj |  dtj |  dtj |  dtj |  dtj |  d	tj |  d
 |  d |  d |  d |  d |  d |  d d S )Nz#
            '{'.format(1)
        z+
            '{} {1}'.format(1, 2)
        z+
            '{0} {}'.format(1, 2)
        z'
            '{}'.format(1, 2)
        z+
            '{}'.format(1, bar=2)
        z'
            '{} {}'.format(1)
        z$
            '{2}'.format()
        z&
            '{bar}'.format()
        z0
            '{:{:{}}}'.format(1, 2, 3)
        z'{.__class__}'.format('')z('{foo[bar]}'.format(foo={'bar': 'barv'})z8
            print('{:{}} {}'.format(1, 15, 2))
        z-
            print('{:2}'.format(1))
        z1
            '{foo}-{}'.format(1, foo=2)
        z8
            a = ()
            "{}".format(*a)
        z<
            k = {}
            "{foo}".format(**k)
        )r	   r
   StringDotFormatInvalidFormatStringDotFormatMixingAutomatic'StringDotFormatExtraPositionalArguments"StringDotFormatExtraNamedArgumentsStringDotFormatMissingArgumentr   r   r   r   test_invalid_dot_format_calls  sD   





z2TestStringFormatting.test_invalid_dot_format_callsc                 C   s   |  dtj |  dtj |  dtj |  dtj |  dtj |  dtj |  dtj |  dtj |  d	tj |  d
tj	 |  dtj
 |  d |  d |  d |  d d S )Nz/
            '%(foo)' % {'foo': 'bar'}
        z3
            '%s %(foo)s' % {'foo': 'bar'}
        z3
            '%(foo)s %s' % {'foo': 'bar'}
        z!
            '%j' % (1,)
        z$
            '%s %s' % (1,)
        z)
            '%s %s' % (1, 2, 3)
        z$
            '%(bar)s' % {}
        z6
            '%(bar)s' % {'bar': 1, 'baz': 2}
        z+
            '%(bar)s' % (1, 2, 3)
        z*
            '%s %s' % {'k': 'v'}
        z1
            '%(bar)*s' % {'bar': 'baz'}
        z:
            '%s' % {'foo': 'bar', 'baz': 'womp'}
        z+
            "%1000000000000f" % 1
        z,
            '%% %s %% %s' % (1, 2)
        zO
            '%.*f' % (2, 1.1234)
            '%*.*f' % (5, 2, 3.1234)
        )r	   r
   PercentFormatInvalidFormat$PercentFormatMixedPositionalAndNamed'PercentFormatUnsupportedFormatCharacter$PercentFormatPositionalCountMismatchPercentFormatMissingArgument PercentFormatExtraNamedArgumentsPercentFormatExpectedMappingPercentFormatExpectedSequence!PercentFormatStarRequiresSequencer   r   r   r   !test_invalid_percent_format_calls  sJ   


z6TestStringFormatting.test_invalid_percent_format_callsc                 C   r   )NzS
            a = []
            '%s %s' % [*a]
            '%s %s' % (*a,)
        z8
            k = {}
            '%(k)s' % {**k}
        r"   r   r   r   r   5test_ok_percent_format_cannot_determine_element_countB  r   zJTestStringFormatting.test_ok_percent_format_cannot_determine_element_countN)rv   rw   rx   r   r   r   r   r   r   r   r   r     s
    64r   c                   @   sl   e Zd Zdd Zdd Zdd Zdd Zd	d
 Zdd Zdd Z	dd Z
dd Zdd Zdd Zdd ZdS )TestAsyncStatementsc                 C   r0   )Nz8
        async def bar():
            return 42
        r"   r   r   r   r   test_asyncDefP  r2   z!TestAsyncStatements.test_asyncDefc                 C   r0   )NzS
        async def read_data(db):
            await db.fetch('SELECT ...')
        r"   r   r   r   r   test_asyncDefAwaitV  r2   z&TestAsyncStatements.test_asyncDefAwaitc                 C   r   )Nz;
        async def bar():
            return foo()
        r5   r   r   r   r   test_asyncDefUndefined\  r    z*TestAsyncStatements.test_asyncDefUndefinedc                 C   r0   )Nz
        async def read_data(db):
            output = []
            async for row in db.cursor():
                output.append(row)
            return output
        r"   r   r   r   r   test_asyncForb  r2   z!TestAsyncStatements.test_asyncForc                 C   r0   )NzY
        async def coro(it):
            async for _ in it:
                pass
        r"   r   r   r   r   test_asyncForUnderscoreLoopVark  r2   z2TestAsyncStatements.test_asyncForUnderscoreLoopVarc                 C   r   )Nz
        async def read_data(db):
            output = []
            async for row in db.cursor():
                if row[0] == 'skip':
                    continue
                output.append(row)
            return output
        z
        async def read_data(db):
            output = []
            async for row in db.cursor():
                if row[0] == 'stop':
                    break
                output.append(row)
            return output
        r"   r   r   r   r   test_loopControlInAsyncForr  s   

z.TestAsyncStatements.test_loopControlInAsyncForc                 C   s    |  dtj |  dtj d S )Nz
        async def read_data(db):
            output = []
            async for row in db.cursor():
                output.append(row)
            else:
                continue
            return output
        z
        async def read_data(db):
            output = []
            async for row in db.cursor():
                output.append(row)
            else:
                break
            return output
        )r	   r
   rJ   rM   r   r   r   r   test_loopControlInAsyncForElse  s   
z2TestAsyncStatements.test_loopControlInAsyncForElsec                 C   r0   )Nz
        async def commit(session, data):
            async with session.transaction():
                await session.update(data)
        r"   r   r   r   r   test_asyncWith  r2   z"TestAsyncStatements.test_asyncWithc                 C   r0   )Nz
        async def commit(session, data):
            async with session.transaction() as trans:
                await trans.begin()
                ...
                await trans.end()
        r"   r   r   r   r   test_asyncWithItem  r2   z&TestAsyncStatements.test_asyncWithItemc                 C   r0   )Nz9
        def foo(a, b):
            return a @ b
        r"   r   r   r   r   test_matmul  r2   zTestAsyncStatements.test_matmulc                 C   r0   )NzE
        hi = 'hi'
        mom = 'mom'
        f'{hi} {mom}'
        r"   r   r   r   r   test_formatstring  r2   z%TestAsyncStatements.test_formatstringc                 C   s4   |  d |  d |  dtj |  dtj d S )Nz;
        raise NotImplementedError("This is fine")
        z+
        raise NotImplementedError
        z?
        raise NotImplemented("This isn't gonna work")
        z&
        raise NotImplemented
        )r	   r
   RaiseNotImplementedr   r   r   r   test_raise_notimplemented  s   

z-TestAsyncStatements.test_raise_notimplementedN)rv   rw   rx   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   N  s    		r   c                   @   sH   e Zd ZdZdd Zdd Zdd Zdd	 Zd
d Zdd Z	dd Z
dS )TestIncompatiblePrintOperatorz@
    Tests for warning about invalid use of print function.
    c                 C   r0   )Nz 
        print("Hello")
        r"   r   r   r   r   test_valid_print  r2   z.TestIncompatiblePrintOperator.test_valid_printc                 C   s4   |  dtjjd }| |jd | |jd d S )Nzn
        from __future__ import print_function
        import sys
        print >>sys.stderr, "Hello"
        r      )r	   r
   InvalidPrintSyntaxr   assertEquallinenocol)r   excr   r   r   ,test_invalid_print_when_imported_from_future  s   zJTestIncompatiblePrintOperator.test_invalid_print_when_imported_from_futurec                 C   r0   )Nz
print += 1r"   r   r   r   r   test_print_augmented_assign  r4   z9TestIncompatiblePrintOperator.test_print_augmented_assignc                 C   r!   )zJ
        A valid assignment, tested for catching false positives.
        z`
        from __future__ import print_function
        log = print
        log("Hello")
        Nr"   r   r   r   r   test_print_function_assignment  ro   z<TestIncompatiblePrintOperator.test_print_function_assignmentc                 C   r0   )NzQ
        from __future__ import print_function
        a = lambda: print
        r"   r   r   r   r   test_print_in_lambda  r2   z2TestIncompatiblePrintOperator.test_print_in_lambdac                 C   r0   )Nza
        from __future__ import print_function
        def a():
            return print
        r"   r   r   r   r   test_print_returned_in_function  r2   z=TestIncompatiblePrintOperator.test_print_returned_in_functionc                 C   r0   )NzN
        from __future__ import print_function
        if print: pass
        r"   r   r   r   r   test_print_as_condition_test  r2   z:TestIncompatiblePrintOperator.test_print_as_condition_testN)rv   rw   rx   r   r   r   r   r   r   r   r   r   r   r   r   r     s    

r   N)r   sysr   pyflakesr   r
   pyflakes.test.harnessr   r   r   r   ry   r   r   r   r   r   r   r   <module>   s,            ^    Z }