
    g                     R    d dl mZ d dlmZmZmZmZmZm	Z	 d dl
mZ  G d de      Zy)    )messages)FunctionScope
ClassScopeModuleScopeArgumentFunctionDefinition
Assignment)TestCasec                   .    e Zd ZdZd Zd Zd Zd Zd Zy)TestCodeSegmentsz(
    Tests for segments of a module
    c                 n    | j                  dd       | j                  dt        j                  d       y )NzH
        def foo():
            def bar():
                pass
        T
is_segmentzI
        def foo():
            def bar():
                x = 0
        flakesmUnusedVariableselfs    b/var/www/html/brdwt/brdwt/brdwtenv/lib/python3.12/site-packages/pyflakes/test/test_code_segment.pytest_function_segmentz&TestCodeSegments.test_function_segment   B      	 	 	 	  $	 	 	0    c                 n    | j                  dd       | j                  dt        j                  d       y )NzH
        class Foo:
            class Bar:
                pass
        Tr   zI
        class Foo:
            def bar():
                x = 0
        r   r   s    r   test_class_segmentz#TestCodeSegments.test_class_segment   r   r   c                 >   | j                  dd      }|j                  }|D cg c]  }|j                  t        u s| }}|D cg c]  }|j                  t        u s| }}|D cg c]  }|j                  t
        u s| }}| j                  t        |      d       | j                  t        |      d       | j                  t        |      d       |d   }|d   }| j                  |t               | j                  |t
               | j                  d|       | j                  d|       | j                  d|       | j                  d	|       | j                  d
|       | j                  d|       | j                  |d   t               | j                  |d   t               | j                  |d   t               | j                  |d	   t               | j                  |d
   t               | j                  |d   t               y c c}w c c}w c c}w )Nzi
        class Foo:
            x = 0
            def bar(a, b=1, *d, **e):
                pass
        Tr   r      xbarabde)r   
deadScopes	__class__r   r   r   assertEquallenassertIsInstanceassertInr   r	   r   )	r   checkerscopesscopemodule_scopesclass_scopesfunction_scopesclass_scopefunction_scopes	            r   test_scope_classz!TestCodeSegments.test_scope_class&   s   ++ 
    ##%IK)GEI I  &HJ)FEH H  &KM)IEK K
 	]+Q/\*A._-q1"1o(+k:6nm<c;'e[)c>*c>*c>*c>*k%02DEk#.
;nS18<nS18<nS18<nS18<CIHKs"   HHHH(H Hc                    | j                  dd      }|j                  }|D cg c]  }|j                  t        u s| }}|D cg c]  }|j                  t        u s| }}| j                  t        |      d       | j                  t        |      d       |d   }|d   }| j                  |t               | j                  |t               | j                  d|       | j                  d|       | j                  d	|       | j                  d
|       | j                  d|       | j                  d|       | j                  d|       | j                  d|       | j                  d|       | 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               y c c}w c c}w )Nzf
        def foo(a, b=1, *d, **e):
            def bar(f, g=1, *h, **i):
                pass
        Tr   r      r   r    r!   r"   r#   r   fghi)r   r$   r%   r   r   r&   r'   r(   r)   r   r   )r   r*   r+   r,   r-   r/   function_scope_foofunction_scope_bars           r   test_scope_functionz$TestCodeSegments.test_scope_functionR   s=   ++  	   ##%IK)GEI I  &KM)IEK K
 	]+Q/_-q1,Q/,Q/0-@0-@c-.c-.c-.c-.e/0c-.c-.c-.c-.079KL05x@05x@05x@05x@05x@05x@05x@05x@IIKs   IIIIc                 *    | j                  dd       y )Nzasync def foo(): passTr   )r   r   s    r   test_scope_async_functionz*TestCodeSegments.test_scope_async_function   s    +=r   N)	__name__
__module____qualname____doc__r   r   r2   r;   r=    r   r   r   r      s#    00*=X,A\>r   r   N)pyflakesr   r   pyflakes.checkerr   r   r   r   r   r	   pyflakes.test.harnessr
   r   rB   r   r   <module>rF      s%    "H H *z>x z>r   