
    0hhw                     F   S SK r S SKrS SKrS SKrS SKrS SKrS SKJr  S r	Sr
SrSrSrSrS	rS
rSrSrSrSrSrSrSr " S S\\ R0                  5      r " S S\5      r " S S\5      r " S S\ R0                  5      r " S S\5      r\S:X  a  \ R>                  " 5         gg)    N)ASTTestMixinc                     [         R                  " U 5       nUR                  5       sS S S 5        $ ! , (       d  f       g = fN)tokenizeopenread)filenamestreams     :/opt/python-3.13.8/usr/lib/python3.13/test/test_unparse.pyread_pyfiler      s'     
x	 F{{} 
!	 	 s   1
?zQdef f():
    for x in range(10):
        break
    else:
        y = 2
    z = 3
zIdef g():
    while True:
        break
    else:
        y = 2
    z = 3
zQfrom . import fred
from .. import barney
from .australia import shrimp as prawns
zzdef f():
    x = 1
    def g():
        nonlocal x
        x = 2
        y = 7
        def h():
            nonlocal x, y
zOtry:
    1 / 0
except ZeroDivisionError as e:
    raise ArithmeticError from e
z@f1(arg)
@f2
class Foo: pass
z=if cond1:
    suite1
elif cond2:
    suite2
else:
    suite3
z,if cond1:
    suite1
elif cond2:
    suite2
zctry:
    suite1
except ex1:
    suite2
except ex2:
    suite3
else:
    suite4
finally:
    suite5
zetry:
    suite1
except* ex1:
    suite2
except* ex2:
    suite3
else:
    suite4
finally:
    suite5
zwith f():
    suite1
zwith f() as x:
    suite1
z$with f() as x, g() as y:
    suite1
) zclass foo:
    zdef foo():
    zasync def foo():
    c                   D    \ rS rSrS r\4S jrS	S jrS	S jrS	S jr	Sr
g)
ASTTestCase   c                     U R                  XS9   [        R                  " U40 UD6n[        R                  " U5      n[        R                  " U40 UD6nU R	                  X55        S S S 5        g ! , (       d  f       g = f)N)code1ast_parse_kwargs)subTestastparseunparseassertASTEqual)selfr   kwargsast1code2ast2s         r   check_ast_roundtripASTTestCase.check_ast_roundtrip   s_    \\\?99U-f-DKK%E99U-f-D+	 @??s   AA//
A=c                     U R                  US9   U R                  U[        R                  U5        S S S 5        g ! , (       d  f       g = f)N)node)r   assertRaisesr   r   )r   r!   raisess      r   check_invalidASTTestCase.check_invalid   s2    \\t\$fckk48 %$$s	   ";
A	Nc                 r    U=(       d    Un[         R                  " [         R                  " U5      5      nX4$ r   )r   r   r   r   r   r   s      r   
get_sourceASTTestCase.get_source   s*    CIIe,-|    c                     U R                  X5      u  pU R                  XS9   U R                  X!5        S S S 5        g ! , (       d  f       g = fN)r   r   )r(   r   assertEqualr'   s      r   check_src_roundtripASTTestCase.check_src_roundtrip   s:    u4\\\3U* 433	   >
Ac                     U R                  X5      u  pU R                  XS9   U R                  X!5        S S S 5        g ! , (       d  f       g = fr,   )r(   r   assertNotEqualr'   s      r   check_src_dont_roundtrip$ASTTestCase.check_src_dont_roundtrip   s:    u4\\\3- 433r0    r   )__name__
__module____qualname____firstlineno__r   
ValueErrorr$   r(   r.   r3   __static_attributes__r5   r*   r   r   r      s     , *4 9
+
.r*   r   c                   4   \ rS rSrS rS rS rS rS rS r	S r
S	 rS
 rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS r S r!S  r"S! r#S" r$S# r%S$ r&S% r'S& r(S' r)S( r*S) r+S* r,S+ r-S, r.S- r/S. r0S/ r1S0 r2S1 r3S2r4g3)4UnparseTestCase   c                 $   U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S	5        U R                  S
5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        g )Nzf'a'zf'{{}}'zf'{{5}}'z	f'{{5}}5'z	f'X{{}}X'zf'{a}'zf'{ {1:2}}'zf'a{a}a'zf'a{a}{a}a'zf'a{a}a{a}a'zf'{a!r}x{a!s}12{{}}{a!a}'z	f'{a:10}'zf'{a:100_000{10}}'zf'{a!r:10}'zf'{a:a{b}10}'zRf'a{b}{c!s}{d!r}{e!a}{f:a}{g:a{b}}{h!s:a}{j!s:{a}b}{k!s:a{b}c}{l!a:{b}c{d}}{x+y=}'r   r   s    r   test_fstringsUnparseTestCase.test_fstrings   s      (  +  ,  -  -  *  /  ,  /  0  !<=  -  !56  /  1  <	
r*   c                     U R                  S5        U R                  S5        U R                  S5        U R                  S5        g )Nzf'{f"{0}"*3}'zf'{f"{y}"*3}'zf''zf"""'end' "quote\""""r@   rA   s    r   test_fstrings_special_chars+UnparseTestCase.test_fstrings_special_chars   s=      !56  !56  +  !=>r*   c                     U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        g )Nzf'''{"'"}'''%f'''-{f"""*{f"+{f'.{x}.'}+"}*"""}-'''z4f'''-{f"""*{f"+{f'.{x}.'}+"}*"""}-'single quote\''''zf"""{'''
'''}"""zf"""{g('''
''')}"""z	f"a\r\nb"f"\u2028{'x'}"r@   rA   s    r   test_fstrings_complicated)UnparseTestCase.test_fstrings_complicated   sk      !34  !RS  !bc  !:;  !=>  !23  !67r*   c                 H    U R                  S5        U R                  S5        g )Nz0f" something { my_dict["key"] } something else "z!f"{f"{f"{f"{f"{f"{1+1}"}"}"}"}"}"r@   rA   s    r   test_fstrings_pep701$UnparseTestCase.test_fstrings_pep701   s       !ST  !DEr*   c                 j    U R                  S5        U R                  S5        U R                  S5        g )Nzu'foo'zr'foo'zb'foo'r@   rA   s    r   test_stringsUnparseTestCase.test_strings   s,      *  *  *r*   c                 &    U R                  S5        g )Nzdel x, y, zr@   rA   s    r   test_del_statement"UnparseTestCase.test_del_statement   s      /r*   c                 H    U R                  S5        U R                  S5        g )Nz45 << 2z13 >> 7r@   rA   s    r   test_shiftsUnparseTestCase.test_shifts   s      +  +r*   c                 .    U R                  [        5        g r   )r   for_elserA   s    r   test_for_elseUnparseTestCase.test_for_else   s      *r*   c                 .    U R                  [        5        g r   )r   
while_elserA   s    r   test_while_elseUnparseTestCase.test_while_else         ,r*   c                     U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        g )Nz(-1)**7z(-1.)**8z(-1j)**6znot True or FalsezTrue or not Falser@   rA   s    r   test_unary_parens!UnparseTestCase.test_unary_parens   sJ      +  ,  ,  !45  !45r*   c                 &    U R                  S5        g )Nz3 .__abs__()r@   rA   s    r   test_integer_parens#UnparseTestCase.test_integer_parens   s      0r*   c                     U R                  S5        U R                  S5        U R                  S5        U R                  S5        g )N1e1000z-1e10001e1000jz-1e1000jr@   rA   s    r   test_huge_floatUnparseTestCase.test_huge_float   s:      *  +  +  ,r*   c                     U R                  [        R                  " [        R                  " [        R                  " [        S5      S95      5      [        R                  " S5      5        g )Nnanvaluez1e1000 - 1e1000)r   r   r   r   ConstantfloatrA   s    r   test_nanUnparseTestCase.test_nan   s?    IIckk#,,U5\"BCDII'(	
r*   c                 l    U R                  [        S5      5        U R                  [        S5      5        g )Ni   l         )r   strrA   s    r   test_min_intUnparseTestCase.test_min_int   s&      Z1  Z1r*   c                     U R                  S5        U R                  S5        U R                  S5        U R                  S5        g )N7jz-7j0jz-0jr@   rA   s    r   test_imaginary_literals'UnparseTestCase.test_imaginary_literals   s:      &  '  &  'r*   c                 &    U R                  S5        g )Nz(lambda: int)()r@   rA   s    r   test_lambda_parentheses'UnparseTestCase.test_lambda_parentheses         !23r*   c                 H    U R                  S5        U R                  S5        g )Nz
1 < 4 <= 5za is b is c is not dr@   rA   s    r   test_chained_comparisons(UnparseTestCase.test_chained_comparisons  s      .  !78r*   c                    U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S	5        U R                  S
5        U R                  S5        U R                  S5        g )Nzdef f(): passzdef f(a): passzdef f(b = 2): passzdef f(a, b): passzdef f(a, b = 2): passzdef f(a = 5, b = 2): passzdef f(*, a = 1, b = 2): passzdef f(*, a = 1, b): passzdef f(*, a, b = 2): passz&def f(a, b = None, *, c, **kwds): passz'def f(a=2, *args, c=5, d, **kwds): passzdef f(*args, **kwargs): passr@   rA   s    r   test_function_arguments'UnparseTestCase.test_function_arguments  s      1  !12  !56  !45  !89  !<=  !?@  !;<  !;<  !IJ  !JK  !?@r*   c                 .    U R                  [        5        g r   )r   relative_importrA   s    r   test_relative_import$UnparseTestCase.test_relative_import        1r*   c                 .    U R                  [        5        g r   )r   nonlocal_exrA   s    r   test_nonlocalUnparseTestCase.test_nonlocal        -r*   c                 .    U R                  [        5        g r   )r   
raise_fromrA   s    r   test_raise_fromUnparseTestCase.test_raise_from  r`   r*   c                 &    U R                  S5        g )Nzb'123'r@   rA   s    r   
test_bytesUnparseTestCase.test_bytes  s      *r*   c                     U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        g )Nzdef f(a : int): passzdef f(a: int = 5): passzdef f(*args: [int]): passzdef f(**kwargs: dict): passzdef f() -> None: passr@   rA   s    r   test_annotations UnparseTestCase.test_annotations  sM      !78  !:;  !<=  !>?  !89r*   c                 &    U R                  S5        g )Nz{'a', 'b', 'c'}r@   rA   s    r   test_set_literal UnparseTestCase.test_set_literal&  r   r*   c           
          U R                  [        R                  " [        R                  " [        R                  " / S95      5      [        R                  " S5      5        g )N)eltsz{*()})r   r   r   r   SetrA   s    r   test_empty_setUnparseTestCase.test_empty_set)  s:    IIckk#''r"234IIg	
r*   c                 &    U R                  S5        g )Nz{x for x in range(5)}r@   rA   s    r   test_set_comprehension&UnparseTestCase.test_set_comprehension/  s      !89r*   c                 &    U R                  S5        g )Nz{x: x*x for x in range(10)}r@   rA   s    r   test_dict_comprehension'UnparseTestCase.test_dict_comprehension2  s      !>?r*   c                 .    U R                  [        5        g r   )r   class_decoratorrA   s    r   test_class_decorators%UnparseTestCase.test_class_decorators5  r   r*   c                 &    U R                  S5        g )Nz(class A(metaclass=type, *[], **{}): passr@   rA   s    r   test_class_definition%UnparseTestCase.test_class_definition8  s      !KLr*   c                 X    U R                  [        5        U R                  [        5        g r   )r   elif1elif2rA   s    r   
test_elifsUnparseTestCase.test_elifs;  s      '  'r*   c                 .    U R                  [        5        g r   )r   try_except_finallyrA   s    r   test_try_except_finally'UnparseTestCase.test_try_except_finally?  s      !34r*   c                 .    U R                  [        5        g r   )r   try_except_star_finallyrA   s    r   test_try_except_star_finally,UnparseTestCase.test_try_except_star_finallyB  s      !89r*   c                     U R                  S5        U R                  S5        U R                  S5        U R                  S5        g )Nza, *b, c = seqza, (*b, c) = seqza, *b[0], c = seqza, *(b, c) = seqr@   rA   s    r   test_starred_assignment'UnparseTestCase.test_starred_assignmentE  s>      !12  !34  !45  !34r*   c                 .    U R                  [        5        g r   )r   with_simplerA   s    r   test_with_simple UnparseTestCase.test_with_simpleK  r   r*   c                 .    U R                  [        5        g r   )r   with_asrA   s    r   test_with_asUnparseTestCase.test_with_asN  s      )r*   c                 .    U R                  [        5        g r   )r   with_two_itemsrA   s    r   test_with_two_items#UnparseTestCase.test_with_two_itemsQ  s      0r*   c                 H    U R                  S5        U R                  S5        g )Nz{**{'y': 2}, 'x': 1}z{**{'y': 2}, **{'x': 1}}r@   rA   s    r   test_dict_unpacking_in_dict+UnparseTestCase.test_dict_unpacking_in_dictT  s       !<=  !@Ar*   c                 4   U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S	5        U R                  S
5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        g )Nza[i]za[i,]za[i, j]za[(*a,)]za[*a]za[b, *a]za[*a, c]za[b, *a, c]	a[*a, *a]za[b, *a, *a]za[*a, b, *a]za[*a, *a, b]za[b, *a, *a, c]z	a[(a:=b)]za[(a:=b,c)]a[()]za[i:j]za[:j]za[i:]za[i:j:k]za[:j:k]za[i::k]za[i:j,]z	a[i:j, k]r@   rA   s    r   test_slicesUnparseTestCase.test_slicesY  sS     (  )  +  ,  )  ,  ,  /  -  0  0  0  !23  -  /  )  *  )  )  ,  +  +  +  -r*   c           
          U R                  [        R                  " S [        R                  " S[        R                  " 5       S9S95        g )NXidctx)exccause)r$   r   RaiseNameLoadrA   s    r   test_invalid_raise"UnparseTestCase.test_invalid_raiset  s,    399SXX#((*5UVWr*   c           	          U R                  [        R                  " [        R                  " S[        R                  " 5       S9[        R
                  " SS9/S95        g )Ntestr   rn   )values)r$   r   	JoinedStrr   r   rp   rA   s    r   test_invalid_fstring_value*UnparseTestCase.test_invalid_fstring_valuew  sA    MMHHCHHJ7LLv.	
r*   c           
          U R                  [        R                  " [        R                  " [        R                  " SS9SS S95      S5        g )Nz\\rn   )ro   
conversionformat_specz{'\\\\'})r-   r   r   FormattedValuerp   rA   s    r   test_fstring_backslash&UnparseTestCase.test_fstring_backslash  s@    ..&)ll&@+-,0 *	+r*   c                 J    U R                  [        R                  " S S95        g )Nrn   )r$   r   	YieldFromrA   s    r   test_invalid_yield_from'UnparseTestCase.test_invalid_yield_from  s    3==t45r*   c                 >   [         R                  " S[         R                  " SS9/S9nU R                  [         R                  " U5      S5        [         R                  " S[         R                  " SS9/S S9nU R                  [         R                  " U5      S5        g )Nmodx)name)modulenameszfrom mod import x)r   r   level)r   
ImportFromaliasr-   r   )r   trees     r   test_import_from_level_none+UnparseTestCase.test_import_from_level_none  sp    ~~U399#3F2GHT*,?@~~U399#3F2GtTT*,?@r*   c                 D    SnU H  nU R                  SU S35        M     g )N)zthis ends with double quote"z"this includes a """triple quote"""z\r	z\t
z\nz	\r	\t
\nz$""">>> content = """blabla""" <<<"""z	foo\n\x00z' \'\'\'""" ""\'\' \'u   🐍⛎𩸽üéş^\\X\\BB⟿z'''r@   )r   
docstrings	docstrings      r   test_docstringsUnparseTestCase.test_docstrings  s,    

 $I$$s9+S%9: $r*   c                     U R                  [        R                  " SS S9S5        U R                  [        R                  " SS S9S5        g )N)   )ro   kindz(1,))r        z	(1, 2, 3))r.   r   rp   rA   s    r   test_constant_tuples$UnparseTestCase.test_constant_tuples  s;      Dt!DfM  LLyt4k	
r*   c                 6    S H  nU R                  USS9  M     g )N)z	() -> intz(int, int) -> intz=(Callable[complex], More[Complex(call.to_typevar())]) -> None	func_type)moder@   )r   function_types     r   test_function_type"UnparseTestCase.test_function_type  s#    
M
 $$]$E
r*   c                 6    S H  nU R                  USS9  M     g )N)za = 5 # type:za = 5 # type: intza = 5 # type: int and morez!def x(): # type: () -> None
	passz.def x(y): # type: (int) -> None and more
	passz'async def x(): # type: () -> None
	passz4async def x(y): # type: (int) -> None and more
	passzfor x in y: # type: int
	passz#async for x in y: # type: int
	passzwith x(): # type: int
	passz!async with x(): # type: int
	passTtype_commentsr@   r   	statements     r   test_type_comments"UnparseTestCase.test_type_comments  s#    
I $$Yd$C
r*   c                 6    S H  nU R                  USS9  M     g )N)
za = 5 # type: ignoreza = 5 # type: ignore and morezdef x(): # type: ignore
	passz'def x(y): # type: ignore and more
	passz#async def x(): # type: ignore
	passz-async def x(y): # type: ignore and more
	passz for x in y: # type: ignore
	passz&async for x in y: # type: ignore
	passzwith x(): # type: ignore
	passz$async with x(): # type: ignore
	passTr  r@   r  s     r   test_type_ignore UnparseTestCase.test_type_ignore  s#    
I $$Yd$C
r*   r5   N)5r6   r7   r8   r9   rB   rE   rJ   rM   rP   rS   rV   rZ   r^   rb   re   rj   rr   rv   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;   r5   r*   r   r=   r=      s    
*?8F+
0,+-61-
2(49A2.-+:4
:@2M(5:5.*1B
.6X
+6A;(
FD Dr*   r=   c                   h    \ rS rSrS rS rS rS rS rS r	S r
S	 rS
 rS rS rS rS rS rSrg)CosmeticTestCasei  c                    U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S	5        U R                  S
5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        g )Nz(a := b)zawait xzx if x else yzlambda x: xz1 + 1z	1 + 2 / 3z(1 + 2) / 3z(1 + 2) * 3 + 4 * (5 + 2)z(1 + 2) * 3 + 4 * (5 + 2) ** 2z~xzx and yzx and y and zzx and (y and x)z(x and y) and zz(x ** y) ** z ** qzx >> yzx << yzx >> y and x >> zzx + y - z * q ^ t ** kzP * V if P and V else n * R * Tz"lambda P, V, n: P * V == n * R * Tzflag & (other | foo)z
not x == yzx == (not y)zyield xzyield from xzcall((yield x))zreturn x + (yield x)r.   rA   s    r   test_simple_expressions_parens/CosmeticTestCase.test_simple_expressions_parens  s     ,  +  1  /  )  -  /  !<=  !AB  &  +  1  !23  !23  !56  *  *  !45  !9:  !BC  !EF  !78  .  0  +  0  !23  !78r*   c                 X   U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S	5        U R                  S
5        g )Nclass X:
    passzclass X(A):
    passzclass X(A, B, C, D):
    passzclass X(x=y):
    passzclass X(metaclass=z):
    passzclass X(x=y, z=d):
    passzclass X(A, x=y):
    passzclass X(A, **kw):
    passzclass X(*args):
    passz"class X(*args, **kwargs):
    passr  rA   s    r   test_class_bases_and_keywords.CosmeticTestCase.test_class_bases_and_keywords  s      !56  !89  !AB  !:;  !BC  !?@  !=>  !>?  !<=  !FGr*   c                     U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        g )NrH   z*f'-{f'''*{f"""+{f".{f'{x}'}."}+"""}*'''}-'z/f'-{f'*{f'''+{f""".{f"{f'{x}'}"}."""}+'''}*'}-'rI   zf'{x}\n'zf"{'\n'}\n"zf"{f'{x}\n'}\n"r  rA   s    r   rB   CosmeticTestCase.test_fstrings  sj      !RS  !YZ  !`a  !67  -  !45  !89r*   c                 ^    Sn[          H!  nU H  nU R                  U U 35        M     M#     g )N)z"""simple doc string"""z7"""A more complex one
            with some newlines"""z,"""Foo bar baz

            empty newline"""z"""With some 	"""z"""Foo "bar" baz """z"""\r"""z""""""z	"""'''"""z"""''''''"""u"   """🐍⛎𩸽üéş^\\X\\BB⟿"""z"""end in single 'quote'"""z'''end in double "quote"'''z#"""almost end in double "quote".""")docstring_prefixesr.   )r   r  prefixr  s       r   r   CosmeticTestCase.test_docstrings  s6    

& )F'	((F8I;)?@ ( )r*   c                     Sn[          H4  nU H+  nU U 3nU R                  U5        U R                  U5        M-     M6     g )N)za = """false"""z("""false""" + """unless its optimized"""z1 + 1
"""false"""z"f"""no, top level but f-fstring""")r)  r   r3   )r   docstrings_negativer*  negativesrcs        r   test_docstrings_negative_cases/CosmeticTestCase.test_docstrings_negative_cases$  sL    
 )F/  
+((---c2 0 )r*   c                 x    S H  nU R                  U S35        M     S H  nU R                  U S35        M     g )N)+-~1)notz 1r  )r   r*  s     r   test_unary_op_factor%CosmeticTestCase.test_unary_op_factor6  s>    %F$$xq\2 &F$$xr]3 r*   c                    U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S	5        U R                  S
5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        g )Nr   za[1]za[1, 2]za[*a,]za[1, *a]za[*a, 2]za[1, *a, 2]r   za[1, *a, *a]za[*a, 1, *a]za[*a, *a, 1]za[1, *a, *a, 2]z
a[1:2, *a]z
a[*a, 1:2]r  rA   s    r   r   CosmeticTestCase.test_slices<  s      )  (  + 	  *  ,  ,  /  -  0  0  0  !23  .  .r*   c                    U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        g )	Nzlambda: somethingzfour = lambda: 2 + 2zlambda x: x * 2zsquare = lambda n: n ** 2zlambda x, y: x + yzadd = lambda x, y: x + yz lambda x, y, /, z, q, *, u: Nonezlambda x, *y, **z: Noner  rA   s    r   test_lambda_parameters'CosmeticTestCase.test_lambda_parametersO  sz      !45  !78  !23  !<=  !56  !;<  !CD  !:;r*   c           	          S HD  u  pS H9  nU R                  XS9   U R                  UR                  US95        S S S 5        M;     MF     g ! , (       d  f       MQ  = f)N))zsingle assignmentz{target} = foo)zmultiple assignmentz{target} = {target} = bar)zfor loopzfor {target} in foo:
    pass)zasync for loopz#async for {target} in foo:
    pass)aza,za, bza, *b, cza, (b, c), dza, (b, c, d), *eza, (b, *c, d), eza, (b, *c, (d, e), f), gz[a]z[a, b]z
[a, *b, c]z[a, [b, c], d]z[a, [b, c, d], *e]z[a, [b, *c, d], e]z[a, [b, *c, [d, e], f], g]za, [b, c], dz[a, b, (c, d), (e, f)]za, b, [*c], d, e)source_typetarget)rB  )r   r.   format)r   rA  sourcerB  s       r   test_star_expr_assign_target-CosmeticTestCase.test_star_expr_assign_targetY  sY    $
K( \\k\I,,V]]&]-IJ JI)$
4 JIs   A
Ac                     U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        g )Nz() = []z[] = ()z'() = [a] = c, = [d] = e, f = () = g = hza = b = c = dza, b = c, d = e, f = gz[a, b] = [c, d] = [e, f] = gza, b = [c, d] = e, f = gr  rA   s    r   %test_star_expr_assign_target_multiple6CosmeticTestCase.test_star_expr_assign_target_multiplew  sh      +  +  !JK  1  !9:  !?@  !;<r*   c                 X   U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S	5        U R                  S
5        g )Nzf"'''{1}\"\"\"" zf"'''{1}""\"" zf'"""{1}''' zf'"""{1}""\"' zf"'''{"\n"}""\"" zf'"""{"\n"}''' zf'"""{"\n"}""\"' zf'''"""''\'{"\n"}''' zf'''"""''\'{"\n\"'"}''' z'f'''"""''\'{"""\n\"'''""" '''\n'''}''' r@   rA   s    r   test_multiquote_joined_string.CosmeticTestCase.test_multiquote_joined_string  s      !;<  !67  !45  !78  !:;  !89  !;<  !?@  !CD  !UVr*   c                    SS K nUR                  S5      nU R                  [        U5         U R	                  S5        S S S 5        U R	                  S5        U R	                  S5        U R                  [        U5         U R	                  S5        S S S 5        U R	                  S5        U R	                  S5        g ! , (       d  f       N= f! , (       d  f       NB= f)	Nr   zinvalid escape sequence '\ 'z
f"{x:\ }" z
f"{x:\n}" zf"{x:\\ }" zf"{x:\\\ }" zf"{x:\\\n}" zf"{x:\\\\ }" )reescapeassertWarnsRegexSyntaxWarningr   )r   rN  msgs      r   test_backslash_in_format_spec.CosmeticTestCase.test_backslash_in_format_spec  s    ii78""=#6$$%67 7  !23  !45""=#6$$%:; 7  !67  !89 76 76s   B;>C;
C	
Cc                     U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        g )Nz	f"{x:'}" z
f"{x:\'}" zf"{x:\\'}" zf'\'{x:"}' zf'\'{x:\"}' zf'\'{x:\\"}' r@   rA   s    r   test_quote_in_format_spec*CosmeticTestCase.test_quote_in_format_spec  s[      1  !23  !45  !34  !56  !78r*   c                    U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S5        U R                  S	5        U R                  S
5        U R                  S5        U R                  S5        g )Nztype A = intztype A[T] = intztype A[T: int] = intztype A[T = int] = intztype A[T: int = int] = intztype A[**P] = intztype A[**P = int] = intztype A[*Ts] = intztype A[*Ts = int] = intztype A[*Ts = *int] = intz6def f[T: int = int, **P = int, *Ts = *int]():
    passz8class C[T: int = int, **P = int, *Ts = *int]():
    passr@   rA   s    r   test_type_params!CosmeticTestCase.test_type_params  s      0  !23  !78  !89  !=>  !45  !:;  !45  !:;  !;<  !Z[  !\]r*   r5   N)r6   r7   r8   r9   r   r$  rB   r  r0  r8  r   r=  rE  rH  rK  rS  rV  rY  r;   r5   r*   r   r  r    sM    9<
H:A03$4/&<K<=W:9^r*   r  c                   J    \ rS rSrS rS rS rS rS rS r	S r
S	 rS
 rSrg)ManualASTCreationTestCasei  c                     [         R                  " S/ / [         R                  " 5       // S9n[         R                  " U5        U R	                  [         R
                  " U5      S5        g )Nr   )r   baseskeywordsbodydecorator_listr#  )r   ClassDefPassfix_missing_locationsr-   r   r   r!   s     r   
test_class$ManualASTCreationTestCase.test_class  sI    ||B388:,_ab!!$'T*,@Ar*   c           
          [         R                  " S/ / [         R                  " 5       // [         R                  " S5      /S9n[         R                  " U5        U R                  [         R                  " U5      S5        g )Nr   T)r   r^  r_  r`  ra  type_paramszclass X[T]:
    pass)r   rb  rc  TypeVarrd  r-   r   re  s     r   test_class_with_type_params5ManualASTCreationTestCase.test_class_with_type_params  sZ    ||B388:,_a*-++c*:);=!!$'T*,CDr*   c                    [         R                  " S[         R                  " / / S / / S / S9[         R                  " 5       // S S9n[         R                  " U5        U R                  [         R                  " U5      S5        g )Nfposonlyargsargsvararg
kwonlyargskw_defaultskwargdefaultsr   rr  r`  ra  returnszdef f():
    pass)r   FunctionDef	argumentsrc  rd  r-   r   re  s     r   test_function'ManualASTCreationTestCase.test_function  sj    2BtPR`bjny{|((*
 	!!$'T*,@Ar*   c                 0   [         R                  " S[         R                  " / / S / / S / S9[         R                  " 5       // S [         R                  " S5      /S9n[         R
                  " U5        U R                  [         R                  " U5      S5        g )Nro  rp  ri  r   rr  r`  ra  ry  rj  zdef f[T]():
    pass)r   rz  r{  rc  rk  rd  r-   r   re  s     r   test_function_with_type_params8ManualASTCreationTestCase.test_function_with_type_params  sy    2BtPR`bjny{|((*S)*
 	!!$'T*,CDr*   c                 z   [         R                  " S[         R                  " / / S / / S / S9[         R                  " 5       // S [         R                  " S[         R
                  " S[         R                  " 5       S9S9/S9n[         R                  " U5        U R                  [         R                  " U5      S5        g )	Nro  rp  ri  int)r   )boundr  zdef f[T: int]():
    pass)
r   rz  r{  rc  rk  r   r   rd  r-   r   re  s     r   (test_function_with_type_params_and_boundBManualASTCreationTestCase.test_function_with_type_params_and_bound  s    2BtPR`bjny{|((*SCHHJ0OPQ
 	!!$'T*,HIr*   c                 (   [         R                  " S[         R                  " 5       [         R                  " 5       /[         R                  " S[         R
                  " SS9S9[         R                  " S[         R                  " [         R
                  " SS9[         R                  " 5       S9S9[         R                  " S[         R
                  " SS9S9/S	9n[         R                  " U5        U R                  [         R                  " U5      S
5        g )Nro  ri  r  rn   default_valueTsro   r   Pr   rr  r`  rj  z+def f[T = 1, *Ts = *1, **P = 1]():
    pass)r   rz  r{  rc  rk  rp   TypeVarTupleStarredr   	ParamSpecrd  r-   r   re  s     r   *test_function_with_type_params_and_defaultDManualASTCreationTestCase.test_function_with_type_params_and_default  s    ((*Cs||!/DE  S[[s||Z[G\bebjbjbl5mncA1FG		
 	!!$'T*,Z[r*   c                    [         R                  " S[         R                  " / / S / / S / S9[         R                  " 5       // S S9n[         R                  " U5        U R                  [         R                  " U5      S5        g )Nro  rp  rx  zasync def f():
    pass)r   AsyncFunctionDefr{  rc  rd  r-   r   re  s     r   test_async_function-ManualASTCreationTestCase.test_async_function  sl    ##2BtPR`bjny{|((*
 	!!$'T*,FGr*   c                 0   [         R                  " S[         R                  " / / S / / S / S9[         R                  " 5       // S [         R                  " S5      /S9n[         R
                  " U5        U R                  [         R                  " U5      S5        g )Nro  rp  ri  r  zasync def f[T]():
    pass)r   r  r{  rc  rk  rd  r-   r   re  s     r   $test_async_function_with_type_params>ManualASTCreationTestCase.test_async_function_with_type_params  s{    ##2BtPR`bjny{|((*S)*
 	!!$'T*,IJr*   c                 (   [         R                  " S[         R                  " 5       [         R                  " 5       /[         R                  " S[         R
                  " SS9S9[         R                  " S[         R                  " [         R
                  " SS9[         R                  " 5       S9S9[         R                  " S[         R
                  " SS9S9/S	9n[         R                  " U5        U R                  [         R                  " U5      S
5        g )Nro  ri  r  rn   r  r  r  r  r  z1async def f[T = 1, *Ts = *1, **P = 1]():
    pass)r   r  r{  rc  rk  rp   r  r  r   r  rd  r-   r   re  s     r   0test_async_function_with_type_params_and_defaultJManualASTCreationTestCase.test_async_function_with_type_params_and_default  s    ##((*Cs||!/DE  S[[s||Z[G\bebjbjbl5mncA1FG		
 	!!$'T*,`ar*   r5   N)r6   r7   r8   r9   rf  rl  r|  r  r  r  r  r  r  r;   r5   r*   r   r\  r\    s8    B
E	B
E
J\	H
Kbr*   r\  c                       \ rS rSr\R
                  " \5      R                  S-  r\\S-  4r	1 Skr
Sr\S 5       rS rSrg)	DirectoryTestCasei  z..r   >
   test_ast.pytest_patma.pytest_syntax.pytest_compile.pytest_fstring.pytest_grammar.pytest_tokenize.pytest_type_alias.pytest_asdl_parser.pytest_type_params.pyNc                 &   U R                   b  U R                   $ U R                   VVs/ s HN  nUR                  S5        H5  nUR                  R	                  S5      (       a  M%  UR                  5       PM7     MP     nnn[        R                  R                  S5      (       d[  U Vs1 s H!  nUR                  U R                  ;   d  M  UiM#     nn[        [        R                  " US5      5      n[        X4-  5      nX0l         U$ s  snnf s  snf )Nz*.pybadcpu
   )_files_to_testtest_directoriesglobr   
startswithresolver   supportis_resource_enabledrun_always_filessetrandomsamplelist)cls	directoryitemitemstests_to_run_alwayss        r   files_to_testDirectoryTestCase.files_to_test&  s     )%%% !11
1	!v.99''. DLLN. 1 	 
 ||//6649 #FED#'990D0D#D $(E #F eR01E 45E #/
#Fs   9D&D)DDc                 4   U R                  5        Hr  n[        R                  R                  (       a  [	        SUR                  5        35        U R                  US9   [        U5      nU R                  U5        S S S 5        Mt     g ! , (       d  f       M  = f)NzTesting )r	   )	r  r   r  verboseprintabsoluter   r   r   )r   r  rD  s      r   
test_filesDirectoryTestCase.test_filesE  so    &&(D||## 123t,$T*((0 -,	 ) -,s   B
B	r5   )r6   r7   r8   r9   pathlibPath__file__parentlib_dirr  r  r  classmethodr  r  r;   r5   r*   r   r  r    sS     ll8$++d2G6!12,
 N <1r*   r  __main__) unittesttest.supportr   r  r  r   r   test.support.ast_helperr   r   rY   r]   r   r   r   r   r   r   r   r   r   r   r   r)  TestCaser   r=   r  r\  r  r6   mainr5   r*   r   <module>r     s         
 0
	
		  


 ., 1 1 .6tDk tDn	\^{ \^~bb 1 1 bbJ21 21j zMMO r*   