Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.9/lib2to3/tests/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.9/lib2to3/tests/__pycache__/test_parser.cpython-39.pyc

a

��g�[�@s dZddlmZddlmZmZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlmZddlmZdd	lmZdd
lmZGdd�dej�ZGd
d�dej�ZGdd�dej�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�Z Gdd�de�Z!Gdd�de�Z"Gdd�de�Z#Gdd �d e�Z$Gd!d"�d"e�Z%Gd#d$�d$e�Z&Gd%d&�d&e�Z'Gd'd(�d(e�Z(Gd)d*�d*e�Z)Gd+d,�d,ej�Z*Gd-d.�d.e�Z+Gd/d0�d0e�Z,Gd1d2�d2e�Z-Gd3d4�d4ej�Z.d5d6�Z/e0d7k�re�1�dS)8aFTest suite for 2to3's parser and grammar files.

This is the place to add tests for changes to 2to3's grammar, such as those
merging the grammars for Python 2 and 3. In addition to specific tests for
parts of the grammar we've changed, we also make sure we can parse the
test_grammar.py files from both Python 2 and Python 3.
�)�support)�driver�driver_no_print_statement�N)r)�tokenize�)�
ParseError)�python_symbolsc@seZdZdd�ZdS)�
TestDrivercCsJd}t�|�}|�|jdjdjtj�|�|jdjdjtj�dS)Nzprint 1
print 2
rr)r�parse_string�assertEqualZchildren�type�symsZ
print_stmt)�self�s�t�r�5/usr/local/lib/python3.9/lib2to3/tests/test_parser.py�
test_formfeed#s
zTestDriver.test_formfeedN)�__name__�
__module__�__qualname__rrrrrr
!sr
c@s>eZdZdd�Zdd�Ze�ejdud�dd��Z	d	d
�Z
dS)�TestPgen2CachingcCstjtjddd�dS)NFT��save�force)�pgen2_driver�load_grammarr�grammar_path�rrrr�test_load_grammar_from_txt_file+sz0TestPgen2Caching.test_load_grammar_from_txt_filec	Cs�t��}zztj�|tj�tj��}t�	tj|�t
�|�}t
j|ddd�|�
tj�|��t�|�t
j|ddd�Wt�|�nt�|�0dS)NTrF)�tempfile�mkdtemp�os�path�join�basenamerr�shutil�copyr�_generate_pickle_namer�
assertTrue�exists�unlink�rmtree)r�tmpdir�grammar_copy�pickle_namerrr�test_load_grammar_from_pickle.s�

z.TestPgen2Caching.test_load_grammar_from_pickleNzsys.executable requiredc	Cszt��}tj�|d�}�zPt�|�tj�tj�}tj�||�}tj�||�}t	�
tj|�t	�
tj|�t�|�}t�|�}|�
||�tj|ddd�|�tj�|��ttj�}d|d<tjtjdd|fg|d�|�tj�|��t|d	��T}	t|d	��(}
|j|	��|
��d
d�Wd�n1�s20YWd�n1�sR0YWt	�|�nt	�|�0dS)NZsubdirTr�randomZPYTHONHASHSEEDz-cz{
from lib2to3.pgen2 import driver as pgen2_driver
pgen2_driver.load_grammar(%r, save=True, force=True)
                    )�env�rbzGGrammar caches generated using different hash seeds were not identical.)�msg)r!r"r#r$r%�mkdirr&rrr'r(rr)ZassertNotEqualrr*r+�dict�environ�
subprocess�
check_call�sys�
executable�openr�readr-)rr.Z	tmpsubdirZgrammar_baser/Zgrammar_sub_copyr0Zpickle_sub_nameZsub_envZ
pickle_f_1Z
pickle_f_2rrr�!test_load_grammar_from_subprocess@sD

�
����Hz2TestPgen2Caching.test_load_grammar_from_subprocesscsftd�Gdd�d��G��fdd�d�}|�tj�<|�tjtj��t��d�}|�|j	d�dS)Nz
.load_testc@seZdZdd�ZdS)z=TestPgen2Caching.test_load_packaged_grammar.<locals>.MyLoadercSst�ddi�S)N�elephant�)�pickle�dumps)r�whererrr�get_datalszFTestPgen2Caching.test_load_packaged_grammar.<locals>.MyLoader.get_dataN)rrrrErrrr�MyLoaderksrFcs eZdZdZej�����ZdS)z=TestPgen2Caching.test_load_packaged_grammar.<locals>.MyModuleZparsertestmoduleN)rrr�__file__�	importlib�util�spec_from_loader�__spec__r�rF�modnamerr�MyModulensrNzGrammar.txtrA)
rr;�modulesZ
addCleanup�operator�delitemrZload_packaged_grammarrr@)rrN�grrLr�test_load_packaged_grammarisz+TestPgen2Caching.test_load_packaged_grammar)rrrr r1�unittestZskipIfr;r<r?rSrrrrr*s

(rc@seZdZdd�Zdd�ZdS)�GrammarTestcCst�|�dS)N)rr�r�coderrr�validatexszGrammarTest.validatecCs.z|�|�Wnty Yn
0td��dS)Nz Syntax shouldn't have been valid)rXr�AssertionErrorrVrrr�invalid_syntax{s
zGrammarTest.invalid_syntaxN)rrrrXrZrrrrrUwsrUc@seZdZdd�ZdS)�TestMatrixMultiplicationcCs|�d�|�d�dS)Nza @ bza @= b�rXrrrr�#test_matrix_multiplication_operator�s
z<TestMatrixMultiplication.test_matrix_multiplication_operatorN)rrrr]rrrrr[�sr[c@seZdZdd�ZdS)�
TestYieldFromcCs"|�d�|�d�|�d�dS)Nzyield from xz(yield from x) + yz
yield from�rXrZrrrr�test_yield_from�s

zTestYieldFrom.test_yield_fromN)rrrr`rrrrr^�sr^c@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�TestAsyncAwaitcCsr|�d�|�d�|�d�|�d�|�d�|�d�|�d�|�d�|�d	�|�d
�|�d�dS)NzLasync def foo():
                             await x
                      zYasync def foo():
                             [i async for i in b]
                      z�async def foo():
                             {i for i in b
                                async for i in a if await i
                                  for b in i}
                      zdasync def foo():
                             [await i for i in b if await c]
                      zYasync def foo():
                             [ i for i in b if c]
                      zhasync def foo():

            def foo(): pass

            def foo(): pass

            await x
        zasync def foo(): return await azTdef foo():
            def foo(): pass
            async def foo(): await x
        zawait xz5def foo():
                                   await xzedef foo():
            def foo(): pass
            async def foo(): pass
            await x
        r_rrrr�test_await_expr�s





	



zTestAsyncAwait.test_await_exprcCs"|�d�|�d�|�d�dS)Nz	async = 1z	await = 1zdef async(): passr\rrrr�test_async_var�s

zTestAsyncAwait.test_async_varcCs|�d�dS)NzDasync def foo():
                             async for a in b: passr\rrrr�test_async_for�szTestAsyncAwait.test_async_forcCs|�d�|�d�dS)Nz@async def foo():
                             async with a: passz@def foo():
                                   async with a: passr_rrrr�test_async_with�s
zTestAsyncAwait.test_async_withcCs|�d�|�d�dS)NzLasync def foo():
                   return (i * 2 async for i in arange(42))zFdef foo():
                   return (i * 2 async for i in arange(42))r\rrrr�test_async_generator�s��z#TestAsyncAwait.test_async_generatorN)rrrrbrcrdrerfrrrrra�s
1rac@sTeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZdS)�TestRaiseChangescCs|�d�dS)N�raiser\rrrr�test_2x_style_1�sz TestRaiseChanges.test_2x_style_1cCs|�d�dS)Nz
raise E, Vr\rrrr�test_2x_style_2�sz TestRaiseChanges.test_2x_style_2cCs|�d�dS)Nz
raise E, V, Tr\rrrr�test_2x_style_3�sz TestRaiseChanges.test_2x_style_3cCs|�d�dS)Nzraise E, V, T, Z�rZrrrr�test_2x_style_invalid_1�sz(TestRaiseChanges.test_2x_style_invalid_1cCs|�d�dS)Nzraise E1 from E2r\rrrr�
test_3x_style�szTestRaiseChanges.test_3x_stylecCs|�d�dS)Nzraise E, V from E1rlrrrr�test_3x_style_invalid_1�sz(TestRaiseChanges.test_3x_style_invalid_1cCs|�d�dS)Nzraise E from E1, E2rlrrrr�test_3x_style_invalid_2�sz(TestRaiseChanges.test_3x_style_invalid_2cCs|�d�dS)Nzraise from E1, E2rlrrrr�test_3x_style_invalid_3�sz(TestRaiseChanges.test_3x_style_invalid_3cCs|�d�dS)Nzraise E fromrlrrrr�test_3x_style_invalid_4�sz(TestRaiseChanges.test_3x_style_invalid_4N)rrrrirjrkrmrnrorprqrrrrrrrg�srgc@seZdZdd�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"dAS)B�TestUnpackingGeneralizationscCs|�d�dS)Nzfunc(1, *(2, 3), 4)r\rrrr�test_mid_positional_star�sz5TestUnpackingGeneralizations.test_mid_positional_starcCs|�d�dS)Nz,func(**{'eggs':'scrambled', 'spam':'fried'})r\rrrr�test_double_star_dict_literalsz:TestUnpackingGeneralizations.test_double_star_dict_literalcCs|�d�dS)Nz*func(spam='fried', **{'eggs':'scrambled'})r\rrrr�,test_double_star_dict_literal_after_keywordsszITestUnpackingGeneralizations.test_double_star_dict_literal_after_keywordscCs|�d�|�d�dS)Nzfunc(**{'a':2} or {})zfunc(**() or {})r\rrrr�test_double_star_expressions
z8TestUnpackingGeneralizations.test_double_star_expressioncCs|�d�dS)Nzfunc(*[] or [2])r\rrrr�test_star_expressionsz1TestUnpackingGeneralizations.test_star_expressioncCs|�d�dS)Nz[*{2}, 3, *[4]]r\rrrr�test_list_displaysz.TestUnpackingGeneralizations.test_list_displaycCs|�d�dS)Nz{*{2}, 3, *[4]}r\rrrr�test_set_displaysz-TestUnpackingGeneralizations.test_set_displaycCs|�d�dS)Nz{**{}}r\rrrr�test_dict_display_1sz0TestUnpackingGeneralizations.test_dict_display_1cCs|�d�dS)Nz{**{}, 3:4, **{5:6, 7:8}}r\rrrr�test_dict_display_2sz0TestUnpackingGeneralizations.test_dict_display_2cCs|�d�dS)Nzfunc(* [] or [1])r\rrrr�test_complex_star_expressionsz9TestUnpackingGeneralizations.test_complex_star_expressioncCs|�d�dS)Nz5func(**{1: 3} if False else {x: x for x in range(3)})r\rrrr�#test_complex_double_star_expressionsz@TestUnpackingGeneralizations.test_complex_double_star_expressioncCs|�d�dS)Nzf(a, *b, *c, d)r\rrrr�test_argument_unpacking_1!sz6TestUnpackingGeneralizations.test_argument_unpacking_1cCs|�d�dS)Nzf(**a, **b)r\rrrr�test_argument_unpacking_2$sz6TestUnpackingGeneralizations.test_argument_unpacking_2cCs|�d�dS)Nzf(2, *a, *b, **b, **c, **d)r\rrrr�test_argument_unpacking_3'sz6TestUnpackingGeneralizations.test_argument_unpacking_3cCs|�d�|�d�dS)Nzdef f(a, b): call(a, b)zdef f(a, b,): call(a, b,)r\rrrr�test_trailing_commas_1*s
z3TestUnpackingGeneralizations.test_trailing_commas_1cCs|�d�|�d�dS)Nzdef f(a, *b): call(a, *b)zdef f(a, *b,): call(a, *b,)r\rrrr�test_trailing_commas_2.s
z3TestUnpackingGeneralizations.test_trailing_commas_2cCs|�d�|�d�dS)Nzdef f(a, b=1): call(a, b=1)zdef f(a, b=1,): call(a, b=1,)r\rrrr�test_trailing_commas_32s
z3TestUnpackingGeneralizations.test_trailing_commas_3cCs|�d�|�d�dS)Nzdef f(a, **b): call(a, **b)zdef f(a, **b,): call(a, **b,)r\rrrr�test_trailing_commas_46s
z3TestUnpackingGeneralizations.test_trailing_commas_4cCs|�d�|�d�dS)Nzdef f(*a, b=1): call(*a, b=1)zdef f(*a, b=1,): call(*a, b=1,)r\rrrr�test_trailing_commas_5:s
z3TestUnpackingGeneralizations.test_trailing_commas_5cCs|�d�|�d�dS)Nzdef f(*a, **b): call(*a, **b)zdef f(*a, **b,): call(*a, **b,)r\rrrr�test_trailing_commas_6>s
z3TestUnpackingGeneralizations.test_trailing_commas_6cCs|�d�|�d�dS)Nzdef f(*, b=1): call(*b)zdef f(*, b=1,): call(*b,)r\rrrr�test_trailing_commas_7Bs
z3TestUnpackingGeneralizations.test_trailing_commas_7cCs|�d�|�d�dS)Nzdef f(a=1, b=2): call(a=1, b=2)z!def f(a=1, b=2,): call(a=1, b=2,)r\rrrr�test_trailing_commas_8Fs
z3TestUnpackingGeneralizations.test_trailing_commas_8cCs|�d�|�d�dS)Nzdef f(a=1, **b): call(a=1, **b)z!def f(a=1, **b,): call(a=1, **b,)r\rrrr�test_trailing_commas_9Js
z3TestUnpackingGeneralizations.test_trailing_commas_9cCs|�d�|�d�dS)Nzf = lambda a, b: call(a, b)zf = lambda a, b,: call(a, b,)r\rrrr�test_trailing_commas_lambda_1Ns
z:TestUnpackingGeneralizations.test_trailing_commas_lambda_1cCs|�d�|�d�dS)Nzf = lambda a, *b: call(a, *b)zf = lambda a, *b,: call(a, *b,)r\rrrr�test_trailing_commas_lambda_2Rs
z:TestUnpackingGeneralizations.test_trailing_commas_lambda_2cCs|�d�|�d�dS)Nzf = lambda a, b=1: call(a, b=1)z!f = lambda a, b=1,: call(a, b=1,)r\rrrr�test_trailing_commas_lambda_3Vs
z:TestUnpackingGeneralizations.test_trailing_commas_lambda_3cCs|�d�|�d�dS)Nzf = lambda a, **b: call(a, **b)z!f = lambda a, **b,: call(a, **b,)r\rrrr�test_trailing_commas_lambda_4Zs
z:TestUnpackingGeneralizations.test_trailing_commas_lambda_4cCs|�d�|�d�dS)Nz!f = lambda *a, b=1: call(*a, b=1)z#f = lambda *a, b=1,: call(*a, b=1,)r\rrrr�test_trailing_commas_lambda_5^s
z:TestUnpackingGeneralizations.test_trailing_commas_lambda_5cCs|�d�|�d�dS)Nz!f = lambda *a, **b: call(*a, **b)z#f = lambda *a, **b,: call(*a, **b,)r\rrrr�test_trailing_commas_lambda_6bs
z:TestUnpackingGeneralizations.test_trailing_commas_lambda_6cCs|�d�|�d�dS)Nzf = lambda *, b=1: call(*b)zf = lambda *, b=1,: call(*b,)r\rrrr�test_trailing_commas_lambda_7fs
z:TestUnpackingGeneralizations.test_trailing_commas_lambda_7cCs|�d�|�d�dS)Nz#f = lambda a=1, b=2: call(a=1, b=2)z%f = lambda a=1, b=2,: call(a=1, b=2,)r\rrrr�test_trailing_commas_lambda_8js
z:TestUnpackingGeneralizations.test_trailing_commas_lambda_8cCs|�d�|�d�dS)Nz#f = lambda a=1, **b: call(a=1, **b)z%f = lambda a=1, **b,: call(a=1, **b,)r\rrrr�test_trailing_commas_lambda_9ns
z:TestUnpackingGeneralizations.test_trailing_commas_lambda_9N)#rrrrtrurvrwrxryrzr{r|r}r~rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrs�s@rsc@s�eZdZdd�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+S),�TestFunctionAnnotationscCs|�d�dS)Nzdef f(x) -> list: passr\rrrr�test_1uszTestFunctionAnnotations.test_1cCs|�d�dS)Nzdef f(x:int): passr\rrrr�test_2xszTestFunctionAnnotations.test_2cCs|�d�dS)Nzdef f(*x:str): passr\rrrr�test_3{szTestFunctionAnnotations.test_3cCs|�d�dS)Nzdef f(**x:float): passr\rrrr�test_4~szTestFunctionAnnotations.test_4cCs|�d�dS)Nzdef f(x, y:1+2): passr\rrrr�test_5�szTestFunctionAnnotations.test_5cCs|�d�dS)Nzdef f(a, (b:1, c:2, d)): passr\rrrr�test_6�szTestFunctionAnnotations.test_6cCs|�d�dS)Nz/def f(a, (b:1, c:2, d), e:3=4, f=5, *g:6): passr\rrrr�test_7�szTestFunctionAnnotations.test_7cCsd}|�|�dS)Nzgdef f(a, (b:1, c:2, d), e:3=4, f=5,
                        *g:6, h:7, i=8, j:9=10, **k:11) -> 12: passr\�rrrrr�test_8�szTestFunctionAnnotations.test_8cCsd}|�|�dS)Nz�def f(
          a: str,
          b: int,
          *,
          c: bool = False,
          **kwargs,
        ) -> None:
            call(c=c, **kwargs,)r\r�rrr�test_9�szTestFunctionAnnotations.test_9cCsd}|�|�dS)Nz@def f(
          a: str,
        ) -> None:
            call(a,)r\r�rrr�test_10�szTestFunctionAnnotations.test_10cCsd}|�|�dS)NzGdef f(
          a: str = '',
        ) -> None:
            call(a=a,)r\r�rrr�test_11�szTestFunctionAnnotations.test_11cCsd}|�|�dS)NzHdef f(
          *args: str,
        ) -> None:
            call(*args,)r\r�rrr�test_12�szTestFunctionAnnotations.test_12cCs|�d�|�d�dS)Nz)def f(a: str, b: int) -> None: call(a, b)z+def f(a: str, b: int,) -> None: call(a, b,)r\rrrr�test_13�s
zTestFunctionAnnotations.test_13cCs|�d�|�d�dS)Nz+def f(a: str, *b: int) -> None: call(a, *b)z-def f(a: str, *b: int,) -> None: call(a, *b,)r\rrrr�test_14�s
zTestFunctionAnnotations.test_14cCs|�d�|�d�dS)Nz-def f(a: str, b: int=1) -> None: call(a, b=1)z/def f(a: str, b: int=1,) -> None: call(a, b=1,)r\rrrr�test_15�s
zTestFunctionAnnotations.test_15cCs|�d�|�d�dS)Nz-def f(a: str, **b: int) -> None: call(a, **b)z/def f(a: str, **b: int,) -> None: call(a, **b,)r\rrrr�test_16�s
zTestFunctionAnnotations.test_16cCs|�d�|�d�dS)Nz/def f(*a: str, b: int=1) -> None: call(*a, b=1)z1def f(*a: str, b: int=1,) -> None: call(*a, b=1,)r\rrrr�test_17�s
zTestFunctionAnnotations.test_17cCs|�d�|�d�dS)Nz/def f(*a: str, **b: int) -> None: call(*a, **b)z1def f(*a: str, **b: int,) -> None: call(*a, **b,)r\rrrr�test_18�s
zTestFunctionAnnotations.test_18cCs|�d�|�d�dS)Nz$def f(*, b: int=1) -> None: call(*b)z&def f(*, b: int=1,) -> None: call(*b,)r\rrrr�test_19�s
zTestFunctionAnnotations.test_19cCs|�d�|�d�dS)Nz2def f(a: str='', b: int=2) -> None: call(a=a, b=2)z4def f(a: str='', b: int=2,) -> None: call(a=a, b=2,)r\rrrr�test_20�s
zTestFunctionAnnotations.test_20cCs|�d�|�d�dS)Nz2def f(a: str='', **b: int) -> None: call(a=a, **b)z4def f(a: str='', **b: int,) -> None: call(a=a, **b,)r\rrrr�test_21�s
zTestFunctionAnnotations.test_21N)rrrr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr�ts*r�c@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�TestVarAnnotationscCs|�d�dS)Nz
var1: int = 5r\rrrrr��szTestVarAnnotations.test_1cCs|�d�dS)Nzvar2: [int, str]r\rrrrr��szTestVarAnnotations.test_2cCs|�d�dS)NzCdef f():
    st: str = 'Hello'
    a.b: int = (1, 2)
    return st
r\rrrrr��szTestVarAnnotations.test_3cCs|�d�dS)Nz$def fbad():
    x: int
    print(x)
r\rrrrr��szTestVarAnnotations.test_4cCs|�d�dS)Nzeclass C:
    x: int
    s: str = 'attr'
    z = 2
    def __init__(self, x):
        self.x: int = x
r\rrrrr��szTestVarAnnotations.test_5cCs|�d�dS)Nzlst: List[int] = []r\rrrrr��szTestVarAnnotations.test_6N)	rrrr�r�r�r�r�r�rrrrr��sr�c@seZdZdd�Zdd�ZdS)�
TestExceptcCsd}|�|�dS)NzP
            try:
                x
            except E as N:
                yr\r�rrr�test_new�szTestExcept.test_newcCsd}|�|�dS)NzN
            try:
                x
            except E, N:
                yr\r�rrr�test_old�szTestExcept.test_oldN)rrrr�r�rrrrr��sr�c@seZdZdZdd�ZdS)�TestStringLiterals)*�'�"zr'zr"zR'zR"zu'zu"zU'zU"zb'zb"zB'zB"zf'zf"zF'zF"zur'zur"zUr'zUr"zuR'zuR"zUR'zUR"zbr'zbr"zBr'zBr"zbR'zbR"zBR'zBR"zrb'zrb"zRb'zRb"zrB'zrB"zRB'zRB"cCsH|jD]<}dj||dd�}|�|�dj||dd�}|�|�qdS)Nz{p}spamspamspam{s}���)�prz{p}{s}{s}eggs{s}{s}{s})�prefixes�formatrX)r�preZsingleZtriplerrr�test_lits


zTestStringLiterals.test_litN)rrrr�r�rrrrr�sr�c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�TestSetLiteralcCs|�d�dS)Nzx = {'one'}r\rrrrr�szTestSetLiteral.test_1cCs|�d�dS)Nzx = {'one', 1,}r\rrrrr�szTestSetLiteral.test_2cCs|�d�dS)Nzx = {'one', 'two', 'three'}r\rrrrr�"szTestSetLiteral.test_3cCs|�d�dS)Nzx = {2, 3, 4,}r\rrrrr�%szTestSetLiteral.test_4N)rrrr�r�r�r�rrrrr�sr�c@seZdZdd�ZdS)�TestIdentifiercCs,|�d�|�d�|�d�|�d�dS)Nu!Örter = 'places'
grün = 'green'u蟒 = a蟒 = 锦蛇 = 1uµ = aµ = µµ = 1uA𝔘𝔫𝔦𝔠𝔬𝔡𝔢 = a_𝔘𝔫𝔦𝔠𝔬𝔡𝔢 = 1r\rrrr�test_non_ascii_identifiers,s


z)TestIdentifier.test_non_ascii_identifiersN)rrrr�rrrrr�+sr�c@seZdZdd�Zdd�ZdS)�TestNumericLiteralscCs|�d�|�d�dS)NZ0o7777777777777Z0o7324528887r_rrrr�test_new_octal_notation4s
z+TestNumericLiterals.test_new_octal_notationcCs|�d�|�d�dS)NZ0b101010Z	0b0101021r_rrrr�test_new_binary_notation8s
z,TestNumericLiterals.test_new_binary_notationN)rrrr�r�rrrrr�3sr�c@seZdZdd�ZdS)�TestClassDefcCs6|�d�|�d�|�d�|�d�|�d�dS)Nzclass B(t=7): passzclass B(t, *args): passzclass B(t, **kwargs): passz!class B(t, *args, **kwargs): passz'class B(t, y=9, *args, **kwargs,): passr\rrrr�test_new_syntax>s




zTestClassDef.test_new_syntaxN)rrrr�rrrrr�=sr�c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�TestParserIdempotencyz,A cut-down version of pytree_idempotency.py.c
Cs2tjjrtd|���t|d�� }t�|j�d}Wd�n1sF0Y|�|d|�t|d|d��}|�	�}Wd�n1s�0Yzt
�|�}WnXty�zt
�|�}Wn6ty�}z|�d||f�WYd}~n
d}~00Yn0t|�}||k�r.tt|||��|�d|�dS)	NzParse file: r4rzcan't detect encoding for %s�r)�encodingzParseError on file %s (%s)zIdempotency failed: %s)�testr�verbose�printr=r�detect_encoding�readlineZassertIsNotNoner>rrrrZfail�str�
diff_texts)r�filepath�fpr��sourceZtree�err�newrrr�
parse_fileJs(.�&.
z TestParserIdempotency.parse_filec	CsHt��D]:}|j|d��|�|�Wd�q1s80YqdS)N)r�)rZall_project_filesZsubTestr�)rr�rrr�test_all_project_files_sz,TestParserIdempotency.test_all_project_filescCs,t�d�t�d�t�d�t�d�dS)Nz
a, *b, c = x
z[*a, b] = x
z(z, *y, w) = m
zfor *z, m in d: pass
�rrrrrr�test_extended_unpackingds


z-TestParserIdempotency.test_extended_unpackingN)rrr�__doc__r�r�r�rrrrr�Fsr�c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�TestLiteralscCst�t�|�d�dS)Nz

)rrr�dedentr�rrrrXmszTestLiterals.validatecCsd}|�|�dS)Nu�
            md5test(b"ª" * 80,
                    (b"Test Using Larger Than Block-Size Key "
                     b"and Larger Than One Block-Size Data"),
                    "6f630fad67cda0ee1fb1f562db3aa53e")
            r\r�rrr�test_multiline_bytes_literalspsz*TestLiterals.test_multiline_bytes_literalscCsd}|�|�dS)Nz�
            b"""
            <?xml version="1.0" encoding="UTF-8"?>
            <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN">
            """
            r\r�rrr�'test_multiline_bytes_tripquote_literalsysz4TestLiterals.test_multiline_bytes_tripquote_literalscCsd}|�|�dS)Nu�
            md5test("ª" * 80,
                    ("Test Using Larger Than Block-Size Key "
                     "and Larger Than One Block-Size Data"),
                    "6f630fad67cda0ee1fb1f562db3aa53e")
            r\r�rrr�test_multiline_str_literals�sz(TestLiterals.test_multiline_str_literalsN)rrrrXr�r�r�rrrrr�ks		r�c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�TestNamedAssignmentsz"Also known as the walrus operator.cCst�d�dS)Nzif f := x(): pass
r�rrrr�test_named_assignment_if�sz-TestNamedAssignments.test_named_assignment_ifcCst�d�dS)Nzwhile f := x(): pass
r�rrrr�test_named_assignment_while�sz0TestNamedAssignments.test_named_assignment_whilecCst�d�dS)Nz0any((lastNum := num) == 1 for num in [1, 2, 3])
r�rrrr�test_named_assignment_generator�sz4TestNamedAssignments.test_named_assignment_generatorcCst�d�dS)Nz-[(lastNum := num) == 1 for num in [1, 2, 3]]
r�rrrr�test_named_assignment_listcomp�sz3TestNamedAssignments.test_named_assignment_listcompN)rrrr�r�r�r�r�rrrrr��s
r�c@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�TestPositionalOnlyArgscCst�d�dS)Nz!def one_pos_only_arg(a, /): pass
r�rrrr�test_one_pos_only_arg�sz,TestPositionalOnlyArgs.test_one_pos_only_argcCst�d�dS)Nz4def all_markers(a, b=2, /, c, d=4, *, e=5, f): pass
r�rrrr�test_all_markers�s�z'TestPositionalOnlyArgs.test_all_markerscCst�d�dS)Nz�def all_markers_with_args_and_kwargs(
                           aa, b, /, _cc, d, *args, e, f_f, **kwargs,
                   ):
                       pass
r�rrrr�test_all_with_args_and_kwargs�s�z4TestPositionalOnlyArgs.test_all_with_args_and_kwargscCst�d�dS)Nz,lambda a, b, /, c, d, *args, e, f, **kw: kw
r�rrrr�test_lambda_soup�s�z'TestPositionalOnlyArgs.test_lambda_soupcCst�d�dS)Nzdef func(a,b,/,*,g,e=3): pass
r�rrrr�test_only_positional_or_keyword�sz6TestPositionalOnlyArgs.test_only_positional_or_keywordN)rrrr�r�r�r�r�rrrrr��s
r�c@seZdZdd�ZdS)�TestPickleableExceptioncCs�tdddd�}ttjd�D]h}t�tj||d��}|�|j|j�|�|j|j�|�|j	|j	�|�|j
|j
�|�|j|j�qdS)Nr5r)r�contextr)�protocol)r�rangerB�HIGHEST_PROTOCOL�loadsrCr�argsr5r
�valuer�)rr��protoZerr2rrr�test_ParseError�sz'TestPickleableException.test_ParseErrorN)rrrr�rrrrr��sr�c	Cs(|��}|��}tj||||dddd�S)Nz
(original)z(reserialized)�)Zlineterm)�
splitlines�difflibZunified_diff)�a�b�filenamerrrr��s�r��__main__)2r�r�rrrr�rHrPr#rBr'r9r;r!Ztest.supportr�rTZ
lib2to3.pgen2rrZpgen2.parserZlib2to3.pygramr	rZTestCaser
rrUr[r^rargrsr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�mainrrrr�<module>sR		M
M va
	%!


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