o
    g1                     @   s>   d dl mZ d dlmZmZ eedk dG dd deZdS )    )version_info)TestCaseskipIf)   
   zPython >= 3.10 onlyc                   @   sD   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S )	TestMatchc                 C   s"   |  d |  d |  d d S )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self r   V/home/ubuntu/cloudmapper/venv/lib/python3.10/site-packages/pyflakes/test/test_match.pytest_match_bindings   s   

zTestMatch.test_match_bindingsc                 C   s   |  d |  d d S )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
   r   r   r    test_match_pattern_matched_class   s   
z*TestMatch.test_match_pattern_matched_classc                 C      |  d d S )Nz~
            def f():
                match 1:
                    case _:
                        print('catchall!')
        r   r
   r   r   r   test_match_placeholder/      z TestMatch.test_match_placeholderc                 C   r   )Nz[
            match 1:
                case True:
                    print('true')
        r   r
   r   r   r   test_match_singleton7   r   zTestMatch.test_match_singletonc                 C   r   )Nzb
            match 1:
                case 1 | 2:
                    print('one or two')
        r   r
   r   r   r   test_match_or_pattern>   r   zTestMatch.test_match_or_patternc                 C   r   )Nz
            x = [1, 2, 3]
            match x:
                case [1, *y]:
                    print(f'captured: {y}')
        r   r
   r   r   r   test_match_starE   r   zTestMatch.test_match_starc                 C   r   )Nz
            x = {'foo': 'bar', 'baz': 'womp'}
            match x:
                case {'foo': k1, **rest}:
                    print(f'{k1=} {rest=}')
        r   r
   r   r   r   test_match_double_starM   r   z TestMatch.test_match_double_starN)
__name__
__module____qualname__r   r   r   r   r   r   r   r   r   r   r   r      s    r   N)sysr   pyflakes.test.harnessr   r   r   r   r   r   r   <module>   s    