
    gY	                     T    d dl mZ d dlmZmZ  eedk  d       G d de             Zy)    )version_info)TestCaseskipIf)   
   zPython >= 3.10 onlyc                   <    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
y	)
	TestMatchc                 j    | j                  d       | j                  d       | j                  d       y )Nz
            def f():
                x = 1
                match x:
                    case 1 as y:
                        print(f'matched as {y}')
        z
            def f():
                x = [1, 2, 3]
                match x:
                    case [1, y, 3]:
                        print(f'matched {y}')
        z
            def f():
                x = {'foo': 1}
                match x:
                    case {'foo': y}:
                        print(f'matched {y}')
        flakesselfs    [/var/www/html/brdwt/brdwt/brdwtenv/lib/python3.12/site-packages/pyflakes/test/test_match.pytest_match_bindingszTestMatch.test_match_bindings   s9      	 	  	 	  	    c                 H    | j                  d       | j                  d       y )Nz
            from a import B

            match 1:
                case B(x=1) as y:
                    print(f'matched {y}')
        z
            from a import B

            match 1:
                case B(a, x=z) as y:
                    print(f'matched {y} {a} {z}')
        r   r   s    r    test_match_pattern_matched_classz*TestMatch.test_match_pattern_matched_class   s&      	 	  	r   c                 &    | j                  d       y )Nz~
            def f():
                match 1:
                    case _:
                        print('catchall!')
        r   r   s    r   test_match_placeholderz TestMatch.test_match_placeholder/         	r   c                 &    | j                  d       y )Nz[
            match 1:
                case True:
                    print('true')
        r   r   s    r   test_match_singletonzTestMatch.test_match_singleton7         	r   c                 &    | j                  d       y )Nzb
            match 1:
                case 1 | 2:
                    print('one or two')
        r   r   s    r   test_match_or_patternzTestMatch.test_match_or_pattern>   r   r   c                 &    | j                  d       y )Nz
            x = [1, 2, 3]
            match x:
                case [1, *y]:
                    print(f'captured: {y}')
        r   r   s    r   test_match_starzTestMatch.test_match_starE   r   r   c                 &    | j                  d       y )Nz
            x = {'foo': 'bar', 'baz': 'womp'}
            match x:
                case {'foo': k1, **rest}:
                    print(f'{k1=} {rest=}')
        r   r   s    r   test_match_double_starz TestMatch.test_match_double_starM   r   r   c                 &    | j                  d       y )Nz
            def f(x):
                match x:
                    case 1:
                        def y(): pass
                    case _:
                        def y(): print(1)
                return y
        r   r   s    r   "test_defined_in_different_branchesz,TestMatch.test_defined_in_different_branchesU   s      	r   N)__name__
__module____qualname__r   r   r   r   r   r   r   r!    r   r   r	   r	      s*    . 	r   r	   N)sysr   pyflakes.test.harnessr   r   r	   r%   r   r   <module>r(      s6     2 w 56W W 7Wr   