Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.9/test/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.9/test/__pycache__/test_unparse.cpython-39.opt-2.pyc

a

��g�H�@s�ddlZddlZddlZddlZddlZddlZdd�ZdZdZ	dZ
dZdZd	Z
d
ZdZdZd
ZdZdZdZGdd�dej�ZGdd�de�ZGdd�de�ZGdd�de�Zedkr�e��dS)�NcCs6t�|��}|��Wd�S1s(0YdS�N)�tokenize�open�read)�filename�stream�r�-/usr/local/lib/python3.9/test/test_unparse.py�read_pyfilesr
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
zwith f():
    suite1
zwith f() as x:
    suite1
z$with f() as x, g() as y:
    suite1
)�zclass foo:
    zdef foo():
    zasync def foo():
    c@sFeZdZdd�Zdd�Zefdd�Zddd	�Zdd
d�Zddd
�Z	dS)�ASTTestCasecCs|�t�|�t�|��dSr)�assertEqual�ast�dump)�self�ast1�ast2rrr	�assertASTEqualwszASTTestCase.assertASTEqualcKsl|j||d��Jtj|fi|��}t�|�}tj|fi|��}|�||�Wd�n1s^0YdS)N)�code1Zast_parse_kwargs)�subTestr�parse�unparser)rr�kwargsr�code2rrrr	�check_ast_roundtripzs

zASTTestCase.check_ast_roundtripcCs@|j|d�� |�|tj|�Wd�n1s20YdS)N)�node)rZassertRaisesrr)rrZraisesrrr	�
check_invalid�szASTTestCase.check_invalidNcCs |p|}t�t�|��}||fSr)rrr�rrrrrr	�
get_source�szASTTestCase.get_sourcecCsN|�||�\}}|j||d��|�||�Wd�n1s@0YdS�N)rr)rrr
rrrr	�check_src_roundtrip�szASTTestCase.check_src_roundtripcCsN|�||�\}}|j||d��|�||�Wd�n1s@0YdSr)rrZassertNotEqualrrrr	�check_src_dont_roundtrip�sz$ASTTestCase.check_src_dont_roundtrip)N)N)N)
�__name__�
__module__�__qualname__rr�
ValueErrorrrr r!rrrr	rvs

rc@steZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Z d=d>�Z!d?d@�Z"dAdB�Z#dCdD�Z$dEdF�Z%dGdH�Z&dIdJ�Z'dKdL�Z(dMdN�Z)dOdP�Z*dQdR�Z+dSdT�Z,dUdV�Z-dWdX�Z.dYdZ�Z/d[S)\�UnparseTestCasecCs,|�d�|�d�|�d�|�d�dS)Nz
f'{f"{0}"*3}'z
f'{f"{y}"*3}'zf''zf"""'end' "quote\""""�r�rrrr	�
test_fstrings�s


zUnparseTestCase.test_fstringscCsJ|�d�|�d�|�d�|�d�|�d�|�d�|�d�dS)Nzf'''{"'"}'''�%f'''-{f"""*{f"+{f'.{x}.'}+"}*"""}-'''z4f'''-{f"""*{f"+{f'.{x}.'}+"}*"""}-'single quote\''''zf"""{'''
'''}"""zf"""{g('''
''')}"""z	f"a\r\nb"�f"\u2028{'x'}"r'r(rrr	�test_fstrings_complicated�s





z)UnparseTestCase.test_fstrings_complicatedcCs"|�d�|�d�|�d�dS)Nzu'foo'zr'foo'zb'foo'r'r(rrr	�test_strings�s

zUnparseTestCase.test_stringscCs|�d�dS)Nzdel x, y, zr'r(rrr	�test_del_statement�sz"UnparseTestCase.test_del_statementcCs|�d�|�d�dS)Nz45 << 2z13 >> 7r'r(rrr	�test_shifts�s
zUnparseTestCase.test_shiftscCs|�t�dSr)r�for_elser(rrr	�
test_for_else�szUnparseTestCase.test_for_elsecCs|�t�dSr)r�
while_elser(rrr	�test_while_else�szUnparseTestCase.test_while_elsecCs6|�d�|�d�|�d�|�d�|�d�dS)Nz(-1)**7z(-1.)**8z(-1j)**6znot True or FalsezTrue or not Falser'r(rrr	�test_unary_parens�s




z!UnparseTestCase.test_unary_parenscCs|�d�dS)Nz3 .__abs__()r'r(rrr	�test_integer_parens�sz#UnparseTestCase.test_integer_parenscCs,|�d�|�d�|�d�|�d�dS)NZ1e1000z-1e1000Z1e1000jz-1e1000jr'r(rrr	�test_huge_float�s


zUnparseTestCase.test_huge_floatc	Cs.|�t�t�tjtd�d���t�d��dS)N�nan��valuez1e1000 - 1e1000)rrrr�Constant�floatr(rrr	�test_nan�s�zUnparseTestCase.test_nancCs |�td��|�td��dS)Ni�l����)r�strr(rrr	�test_min_int�szUnparseTestCase.test_min_intcCs,|�d�|�d�|�d�|�d�dS)NZ7jz-7jZ0jz-0jr'r(rrr	�test_imaginary_literals�s


z'UnparseTestCase.test_imaginary_literalscCs|�d�dS)Nz(lambda: int)()r'r(rrr	�test_lambda_parentheses�sz'UnparseTestCase.test_lambda_parenthesescCs|�d�|�d�dS)Nz
1 < 4 <= 5za is b is c is not dr'r(rrr	�test_chained_comparisons�s
z(UnparseTestCase.test_chained_comparisonscCs||�d�|�d�|�d�|�d�|�d�|�d�|�d�|�d�|�d	�|�d
�|�d�|�d�dS)
Nz
def f(): passzdef f(a): passzdef f(b = 2): passzdef f(a, b): passzdef f(a, b = 2): passzdef f(a = 5, b = 2): passzdef f(*, a = 1, b = 2): passzdef f(*, a = 1, b): passzdef f(*, a, b = 2): passz&def f(a, b = None, *, c, **kwds): passz'def f(a=2, *args, c=5, d, **kwds): passzdef f(*args, **kwargs): passr'r(rrr	�test_function_arguments�s










z'UnparseTestCase.test_function_argumentscCs|�t�dSr)r�relative_importr(rrr	�test_relative_import�sz$UnparseTestCase.test_relative_importcCs|�t�dSr)r�nonlocal_exr(rrr	�
test_nonlocal�szUnparseTestCase.test_nonlocalcCs|�t�dSr)r�
raise_fromr(rrr	�test_raise_from�szUnparseTestCase.test_raise_fromcCs|�d�dS)Nzb'123'r'r(rrr	�
test_bytes�szUnparseTestCase.test_bytescCs6|�d�|�d�|�d�|�d�|�d�dS)Nzdef f(a : int): passzdef f(a: int = 5): passzdef f(*args: [int]): passzdef f(**kwargs: dict): passzdef f() -> None: passr'r(rrr	�test_annotations�s




z UnparseTestCase.test_annotationscCs|�d�dS)Nz{'a', 'b', 'c'}r'r(rrr	�test_set_literalsz UnparseTestCase.test_set_literalc	Cs*|�t�t�tjgd���t�d��dS)N)�eltsz{*()})rrrr�Setr(rrr	�test_empty_sets�zUnparseTestCase.test_empty_setcCs|�d�dS)Nz{x for x in range(5)}r'r(rrr	�test_set_comprehensionsz&UnparseTestCase.test_set_comprehensioncCs|�d�dS)Nz{x: x*x for x in range(10)}r'r(rrr	�test_dict_comprehensionsz'UnparseTestCase.test_dict_comprehensioncCs|�t�dSr)r�class_decoratorr(rrr	�test_class_decoratorssz%UnparseTestCase.test_class_decoratorscCs|�d�dS)Nz(class A(metaclass=type, *[], **{}): passr'r(rrr	�test_class_definitionsz%UnparseTestCase.test_class_definitioncCs|�t�|�t�dSr)r�elif1�elif2r(rrr	�
test_elifss
zUnparseTestCase.test_elifscCs|�t�dSr)r�try_except_finallyr(rrr	�test_try_except_finallysz'UnparseTestCase.test_try_except_finallycCs,|�d�|�d�|�d�|�d�dS)Nza, *b, c = seqza, (*b, c) = seqza, *b[0], c = seqza, *(b, c) = seqr'r(rrr	�test_starred_assignments


z'UnparseTestCase.test_starred_assignmentcCs|�t�dSr)r�with_simpler(rrr	�test_with_simple$sz UnparseTestCase.test_with_simplecCs|�t�dSr)r�with_asr(rrr	�test_with_as'szUnparseTestCase.test_with_ascCs|�t�dSr)r�with_two_itemsr(rrr	�test_with_two_items*sz#UnparseTestCase.test_with_two_itemscCs|�d�|�d�dS)Nz{**{'y': 2}, 'x': 1}z{**{'y': 2}, **{'x': 1}}r'r(rrr	�test_dict_unpacking_in_dict-s
z+UnparseTestCase.test_dict_unpacking_in_dictcCs�|�d�|�d�|�d�|�d�|�d�|�d�|�d�|�d�|�d	�|�d
�|�d�|�d�|�d
�|�d�|�d�dS)Nza[i]za[i,]za[i, j]za[(*a,)]z	a[(a:=b)]za[(a:=b,c)]za[()]za[i:j]za[:j]za[i:]za[i:j:k]za[:j:k]za[i::k]za[i:j,]z	a[i:j, k]r'r(rrr	�test_slices2s













zUnparseTestCase.test_slicescCs |�tjdtjdd�d��dS)N�X)�id)�exc�cause)rrZRaise�Namer(rrr	�test_invalid_raiseCsz"UnparseTestCase.test_invalid_raisecCs |�tjtjdd�gd��dS)N�dr8)�values)rrZ	JoinedStrr:r(rrr	�test_invalid_fstring_constantFsz-UnparseTestCase.test_invalid_fstring_constantcCs(|�tjtjddd�td�dd��dS)N�a�r9�kind�Y)r9�
conversion�format_spec)rr�FormattedValuer:�ordr(rrr	�test_invalid_fstring_conversionIs��z/UnparseTestCase.test_invalid_fstring_conversioncCs|�tjtjdd�d��dS)Nz\\r8)rrrqr:r(rrr	�test_invalid_fstring_backslashRsz.UnparseTestCase.test_invalid_fstring_backslashcCs|�tjdd��dS)Nr8)rrZ	YieldFromr(rrr	�test_invalid_yield_fromUsz'UnparseTestCase.test_invalid_yield_fromcCs$d}|D]}|�d|�d��qdS)N)
zthis 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�	docstringrrr	�test_docstringsXszUnparseTestCase.test_docstringscCs0|�tjddd�d�|�tjddd�d�dS)N)�rlz(1,))r|��z	(1, 2, 3))r rr:r(rrr	�test_constant_tuplesls�z$UnparseTestCase.test_constant_tuplescCsdD]}|j|dd�qdS)N)z	() -> intz(int, int) -> intz=(Callable[complex], More[Complex(call.to_typevar())]) -> NoneZ	func_type)�moder')rZ
function_typerrr	�test_function_typersz"UnparseTestCase.test_function_typecCsdD]}|j|dd�qdS)N)z
a = 5 # type:za = 5 # type: intza = 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
	passzfor x in y: # type: int
	passz#async for x in y: # type: int
	passzwith x(): # type: int
	passz!async with x(): # type: int
	passT�Z
type_commentsr'�rZ	statementrrr	�test_type_commentszs
z"UnparseTestCase.test_type_commentscCsdD]}|j|dd�qdS)N)
za = 5 # type: ignoreza = 5 # type: ignore and morezdef 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
	passzwith x(): # type: ignore
	passz$async with x(): # type: ignore
	passTr�r'r�rrr	�test_type_ignore�sz UnparseTestCase.test_type_ignoreN)0r"r#r$r)r,r-r.r/r1r3r4r5r6r<r>r?r@rArBrDrFrHrIrJrKrNrOrPrRrSrVrXrYr[r]r_r`rargrjrsrtrur{rr�r�r�rrrr	r&�sZ
	r&c@sDeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�CosmeticTestCasecCs|�d�|�d�|�d�|�d�|�d�|�d�|�d�|�d�|�d	�|�d
�|�d�|�d�|�d
�|�d�|�d�|�d�|�d�|�d�|�d�|�d�|�d�|�d�|�d�|�d�|�d�|�d�|�d�|�d�dS)Nz(a := b)zawait xz
x if x else yzlambda x: xz1 + 1z	1 + 2 / 3z(1 + 2) / 3z(1 + 2) * 3 + 4 * (5 + 2)z(1 + 2) * 3 + 4 * (5 + 2) ** 2z~xzx and yz
x and y and zzx and (y and x)z(x and y) and zz(x ** y) ** z ** qzx >> yzx << yzx >> y and x >> zzx + y - z * q ^ t ** kzP * V if P and V else n * R * Tz"lambda P, V, n: P * V == n * R * Tzflag & (other | foo)z
not x == yzx == (not y)zyield xzyield from xzcall((yield x))zreturn x + (yield x)�r r(rrr	�test_simple_expressions_parens�s8


























z/CosmeticTestCase.test_simple_expressions_parenscCsh|�d�|�d�|�d�|�d�|�d�|�d�|�d�|�d�|�d	�|�d
�dS)Nzclass X:
    passzclass X(A):
    passzclass X(A, B, C, D):
    passzclass X(x=y):
    passzclass X(metaclass=z):
    passzclass X(x=y, z=d):
    passzclass X(A, x=y):
    passzclass X(A, **kw):
    passzclass X(*args):
    passz"class X(*args, **kwargs):
    passr�r(rrr	�test_class_bases_and_keywords�s








z.CosmeticTestCase.test_class_bases_and_keywordscCs6|�d�|�d�|�d�|�d�|�d�dS)Nr*r+zf'{x}\n'zf'''{"""
"""}\n'''zf'''{f"""{x}
"""}\n'''r�r(rrr	r)�s




zCosmeticTestCase.test_fstringscCs.d}tD] }|D]}|�|�|���qqdS)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 )rry�prefixrzrrr	r{�sz CosmeticTestCase.test_docstringscCs<d}tD].}|D]$}|�|��}|�|�|�|�qqdS)N)za = """false"""z("""false""" + """unless its optimized"""z1 + 1
"""false"""z"f"""no, top level but f-fstring""")r�rr!)rZdocstrings_negativer��negative�srcrrr	�test_docstrings_negative_cases�s
z/CosmeticTestCase.test_docstrings_negative_casescCs8dD]}|�|�d��qdD]}|�|�d��qdS)N)�+�-�~�1)�notz 1r�)rr�rrr	�test_unary_op_factor�sz%CosmeticTestCase.test_unary_op_factorcCs"|�d�|�d�|�d�dS)Nza[1]za[1, 2]z
a[(1, *a)]r�r(rrr	ra�s

zCosmeticTestCase.test_slicesN)
r"r#r$r�r�r)r{r�r�rarrrr	r��sr�c@sHeZdZe�e�jdZeedfZhd�Z	dZ
edd��Zdd�Z
dS)	�DirectoryTestCasez..�test>ztest_asdl_parser.pyztest_fstring.pyztest_syntax.pyztest_ast.pyztest_compile.pyztest_grammar.pyNcsd�jdur�jSdd��jD�}tj�d�sZ�fdd�|D�}tt�|d��}t||B�}|�_|S)NcSs0g|](}|�d�D]}|j�d�s|���qqS)z*.pyZbad)�glob�name�
startswith�resolve)�.0Z	directory�itemrrr	�
<listcomp>s�z3DirectoryTestCase.files_to_test.<locals>.<listcomp>Zcpucsh|]}|j�jvr|�qSr)r��run_always_files)r�r���clsrr	�	<setcomp>s�z2DirectoryTestCase.files_to_test.<locals>.<setcomp>�
)	�_files_to_test�test_directoriesr��supportZis_resource_enabled�set�random�sample�list)r��itemsZtests_to_run_alwaysrr�r	�
files_to_test
s
�zDirectoryTestCase.files_to_testc	Csj|��D]\}tjjr&td|�����|j|d��"t|�}|�|�Wd�q1sZ0YqdS)NzTesting )r)	r�r�r��verbose�print�absoluterr
r)rr��sourcerrr	�
test_files,szDirectoryTestCase.test_files)r"r#r$�pathlib�Path�__file__�parentZlib_dirr�r�r��classmethodr�r�rrrr	r�s
r��__main__)ZunittestZtest.supportr�r�r�rrr
r0r2rCrErGrQrTrUrWrZr\r^r�ZTestCaserr&r�r�r"�mainrrrr	�<module>s6			
i3

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists