nifx j d dl mZ d dlmZmZ eedk d G d de ZdS ) )version_info)TestCaseskipIf)
zPython >= 3.10 onlyc 8 e Zd Zd Zd Zd Zd Zd Zd Zd Z dS ) TestMatchc | 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}')
flakesselfs j/builddir/build/BUILD/cloudlinux-venv-1.0.10/venv/lib/python3.11/site-packages/pyflakes/test/test_match.pytest_match_bindingszTestMatch.test_match_bindings sa
c Z | 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
s r test_match_pattern_matched_classz*TestMatch.test_match_pattern_matched_class sD
r c 0 | d d S )Nz~
def f():
match 1:
case _:
print('catchall!')
r r
s r test_match_placeholderz TestMatch.test_match_placeholder/ '
r c 0 | d d S )Nz[
match 1:
case True:
print('true')
r r
s r test_match_singletonzTestMatch.test_match_singleton7 '
r c 0 | d d S )Nzb
match 1:
case 1 | 2:
print('one or two')
r r
s r test_match_or_patternzTestMatch.test_match_or_pattern> r r c 0 | d d S )Nz
x = [1, 2, 3]
match x:
case [1, *y]:
print(f'captured: {y}')
r r
s r test_match_starzTestMatch.test_match_starE r r c 0 | d d S )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 N)
__name__
__module____qualname__r r r r r r r r r r r s}
.
r r N)sysr pyflakes.test.harnessr r r r# r r