Sindbad~EG File Manager

Current Path : /proc/2568807/root/usr/local/lib/python3.12/test/__pycache__/
Upload File :
Current File : //proc/2568807/root/usr/local/lib/python3.12/test/__pycache__/test_syntax.cpython-312.opt-2.pyc

�

'Μg�#���	ddlZddlZddlZddlZddlmZGd�dej�Zd�Ze	dk(rej�yy)�N)�supportc��eZdZ		d'd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zej4d��Zej4d��Zej4d��Zd�Zd�Zd�Z d�Z!d�Z"d �Z#d!�Z$d"�Z%d#�Z&ej4d$��Z'ej4d%��Z(ej4d&��Z)y)(�SyntaxTestCaseNc
�f�		t|||�|jd�y#t$�r}
|r*t|
|�s|jd|jz�tj|t|
��}|�|jd|���|j|
j|�|�|j|
j|�|�|j|
j|�|�|j|
j|�|	�!|j|
j|	�Yd}
~
yYd}
~
yd}
~
wwxYw)Nz#compile() did not raise SyntaxErrorzSyntaxError is not a %szSyntaxError did not contain )�compile�fail�SyntaxError�
isinstance�__name__�re�search�str�assertEqual�filename�lineno�offset�
end_lineno�
end_offset)�self�code�errtextr�mode�subclassrrrr�err�mos            �-/usr/local/lib/python3.12/test/test_syntax.py�_check_errorzSyntaxTestCase._check_error�s	��	�	=��D�(�D�)�$
�I�I�;�<��#�	=��
�3�� 9��	�	�3�h�6G�6G�G�H����7�C��H�-�B��z��	�	�g�G�H����S�\�\�8�4��!�� � ����V�4��!�� � ����V�4��%�� � �����<��%�� � �����<�<�&��	=�s�
"�
D0�C5D+�+D0c�,�|jddd��y)Nzprint(end1 + end2 = ' ')z=expression cannot contain assignment, perhaps you meant "=="?�)r�r�rs r�test_expression_with_assignmentz.SyntaxTestCase.test_expression_with_assignment�s�����&�K��	�	
�c�,�|jddd��y)Nzf{}�invalid syntax�single�rr r!s r�1test_curly_brace_after_primary_raises_immediatelyz@SyntaxTestCase.test_curly_brace_after_primary_raises_immediatelys�����%�!1���Ar#c�(�|jdd�y)Nzf() = 1�assignr r!s r�test_assign_callzSyntaxTestCase.test_assign_call	s�����)�X�.r#c���|jdd�|jdd�|jdd�|jdd�|jdd	�|jd
d�|jdd	�|jd
d	�|jdd�|jdd�|jdd�|jdd�|jdd�|jdd�|jdd�|jdd�|jdd�|jdd�|jdd�|jdd�|jdd�|jdd�|jdd�|jd d�|jd!d�|jd"d#�|jd$d�y)%Nzdel (,)r%zdel 1zcannot delete literalz
del (1, 2)zdel Nonezcannot delete Nonezdel *xzcannot delete starredzdel (*x)zcannot use starred expressionz	del (*x,)z	del [*x,]zdel f()zcannot delete function callzdel f(a, b)z	del o.f()z
del a[0]()z
del x, f()z
del f(), xzdel [a, b, ((c), (d,), e.f())]zdel (a if True else b)zcannot delete conditionalzdel +azcannot delete expressionz	del a, +bz	del a + bzdel (a + b, c)zdel (c[0], a + b)z
del a.b.c + 2zdel a.b.c[0] + 2zdel (a, b, (c, d.e.f + 2))zdel [a, b, (c, d.e.f[0] + 2)]zdel (a := 5)zcannot delete named expressionz
del a += br r!s r�test_assign_delzSyntaxTestCase.test_assign_dels������)�%5�6����'�#:�;����,�(?�@����*�&:�;����(�$;�<����*�&E�F����+�'>�?����+�'>�?����)�%B�C����-�)F�G����+�'D�E����,�(E�F����,�(E�F����,�(E�F����:�<Y�Z����2�4O�P����(�$>�?����+�'A�B����+�'A�B����*�,F�G����-�/I�J����/�+E�F����,�.H�I����6�8R�S����9�;U�V����.�*J�K�	
���,�(8�9r#c�0�d}|j|dd��y)Nz�if 1:
            def error(a):
                global a  # SyntaxError
            def error2():
                b = 1
                global b  # SyntaxError
            zparameter and global��rr �r�sources  r�test_global_param_err_firstz*SyntaxTestCase.test_global_param_err_first+s!����	
���&�"8���Cr#c�0�d}|j|dd��y)Nz�if 1:
            def error(a):
                nonlocal a  # SyntaxError
            def error2():
                b = 1
                global b  # SyntaxError
            zparameter and nonlocalr/r0r r1s  r�test_nonlocal_param_err_firstz,SyntaxTestCase.test_nonlocal_param_err_first5s!����	
���&�":�1��Er#c�H�|jdd�|jdd�|jdd�|jdd�|jdd�|jdd�|jdd�|jd	d�|jd
d�y)Nzif 0: yield�outside functionzif 0: yield
else:  x=1zif 1: pass
else: yieldzwhile 0: yieldzwhile 0: yield
else:  x=1zclass C:
  if 0: yieldz#class C:
  if 1: pass
  else: yieldzclass C:
  while 0: yieldz(class C:
  while 0: yield
  else:  x = 1r r!s r�test_yield_outside_functionz*SyntaxTestCase.test_yield_outside_function?s������-�8J�K����3�8J�K����3�8J�K����*�8J�K����6�8J�K����3�8J�K����A�,�	.����6�8J�K����F�,�	.r#c�H�|jdd�|jdd�|jdd�|jdd�|jdd�|jdd�|jdd�|jd	d�|jd
d�y)Nzif 0: returnr7zif 0: return
else:  x=1zif 1: pass
else: returnzwhile 0: returnzclass C:
  if 0: returnzclass C:
  while 0: returnz'class C:
  while 0: return
  else:  x=1z$class C:
  if 0: return
  else: x= 1z$class C:
  if 1: pass
  else: returnr r!s r�test_return_outside_functionz+SyntaxTestCase.test_return_outside_functionLs������.�9K�L����4�9K�L����4�9K�L����+�9K�L����4�9K�L����7�9K�L����E�,�	.����B�,�	.����B�,�	.r#c� �d}|jd|d��|jd|d��|jd|d��|jd|d��|jd	|d��|jd
|d��|jd|d��y)
Nzoutside loop�break�r0zif 0: breakzif 0: break
else:  x=1zif 1: pass
else: break�zclass C:
  if 0: breakz#class C:
  if 1: pass
  else: breakr/zwith object() as obj:
 breakr �r�msgs  r�test_break_outside_loopz&SyntaxTestCase.test_break_outside_loopZs��������'�3�q��1����-��Q��7����3�S���C����3�S���C����3�S���C����A��a�	�	)����9��a�	�	)r#c��d}|jd|d��|jd|d��|jd|d��|jd|d��|jd	|d
��|jd|d��y)Nznot properly in loopzif 0: continuer=r0zif 0: continue
else:  x=1zif 1: pass
else: continuer>zclass C:
  if 0: continuez&class C:
  if 1: pass
  else: continuer/z"with object() as obj:
    continuer r?s  r�test_continue_outside_loopz)SyntaxTestCase.test_continue_outside_loopfs���$�����*�C���:����6��A��F����6��A��F����6��A��F����D��a�	�	)����?��a�	�	)r#c�4�|jddt��y)Nz
foo()
 bar()
zunexpected indent�r�r�IndentationErrorr!s r�test_unexpected_indentz%SyntaxTestCase.test_unexpected_indentqs�����+�-@�#3�	�	5r#c�4�|jddt��y)Nzif 1:
foo()zexpected an indented blockrErFr!s r�test_no_indentzSyntaxTestCase.test_no_indentus�����.�*F�#3�	�	5r#c�4�|jddt��y)Nzif 1:
  foo()
 bar()z unindent does not match .* levelrErFr!s r�test_bad_outdentzSyntaxTestCase.test_bad_outdentys�����2�<�#3�	�	5r#c�(�|jdd�y)Nzint(base=10, '2')z,positional argument follows keyword argumentr r!s r�test_kwargs_lastzSyntaxTestCase.test_kwargs_last~s�����-�H�	Jr#c�(�|jdd�y)Nzint(**{'base': 10}, '2')z6positional argument follows keyword argument unpackingr r!s r�test_kwargs_last2z SyntaxTestCase.test_kwargs_last2�s�����4�7�	8r#c�(�|jdd�y)Nzint(**{'base': 10}, *['2'])z>iterable argument unpacking follows keyword argument unpackingr r!s r�test_kwargs_last3z SyntaxTestCase.test_kwargs_last3�s�����7�7�	8r#c�2�|jdddddd��y)Nz<foo(x,    y for y in range(3) for z in range(2) if z    , p)z*Generator expression must be parenthesizedr=��5�rrrrr r!s r�test_generator_in_function_callz.SyntaxTestCase.test_generator_in_function_call�s%�����X�F�!"�q���	�	Lr#c�2�|jdddddd��y)Nz9try: pass
except ValueError: pass
except* TypeError: pass�:cannot have both 'except' and 'except\*' on the same 'try'r/r=�rVr r!s r�test_except_then_except_starz+SyntaxTestCase.test_except_then_except_star��%�����W�W�!"�q��q�	�	Jr#c�2�|jdddddd��y)Nz9try: pass
except* ValueError: pass
except TypeError: passrYr/r=rrVr r!s r�test_except_star_then_exceptz+SyntaxTestCase.test_except_star_then_except�r\r#c���d}	t|dd�d}d}	t|dd�t|dd�y#t$r|jd�Y�<wxYw#t$r|jd�YywxYw)Nz\
pass
        \

pass
�<string>�execz8Empty line after a line continuation character is valid.zN\
def fib(n):
    \
'''Print a Fibonacci series up to n.'''
    \
a, b = 0, 1
zJ\
def fib(n):
    '''Print a Fibonacci series up to n.'''
    a, b = 0, 1
z/Indented statement over multiple lines is valid)rr	r)r�s�s1�s2s    r�test_empty_line_after_linecontz-SyntaxTestCase.test_empty_line_after_linecont�s���
��	R��A�z�6�*�
����
	I��B�
�F�+��B�
�F�+��%�	R��I�I�P�Q�	R��&�	I��I�I�G�H�	I�s �
1�A�A�
A�A.�-A.c�>�d}|jtt|�y)Nz(\
if x:
    y = 1
  \
  foo = 1
        )�assertRaisesrGra�rrs  r�!test_continuation_bad_indentationz0SyntaxTestCase.test_continuation_bad_indentation�s����	
���*�D�$�7r#c��d}td�D]&}|d|z�d�z
}|d|dzz�d�z
}|d|z�d�z
}�(|d�d	�z
}|j|d
�y)N��z    ztry:
r=zraise Exception
zexcept Exception as e:
z0                                                �pass�!too many statically nested blocks)�ranger)rr�is   r�test_nested_named_except_blocksz.SyntaxTestCase.test_nested_named_except_blocks�s~�����r��A��v�a�x�j��'�'�D��v�q��s�|�n�$5�6�6�D��v�a�x�j� 8�9�9�D��	
�8�*�D�!�!�����$� C�Dr#c�Z�d�}d}|dz
}t|�D]2}|jd|���5t||�dd�ddd��4t||dz�D]7}|jd|���5|j||�d	�ddd��9y#1swY��xYw#1swY�PxYw)
Nc�l�tjd�}t|�D]}|d|�d�z
}�
|dz
}|S)Nz]
                def bug():
                    with (
                    a
                �    as a�, a
�
): yield a)�textwrap�dedentro��nrrps   r�get_codezJSyntaxTestCase.test_with_statement_many_context_managers.<locals>.get_code�sG���?�?�$��D�
�1�X���(�1�#�U�+�+����L� �D��Kr#�r=�within range: n=r`ra��out of range: n=rn�ro�subTestrr�rr{�CO_MAXBLOCKS�MAX_MANAGERSrzs     r�)test_with_statement_many_context_managersz8SyntaxTestCase.test_with_statement_many_context_managers�s���		���#�a�'���|�$�A���� 1�q�d�3�4�����Z��8�5�4�%��|�\�A�%5�6�A���� 1�q�d�3�4��!�!�(�1�+�/R�S�5�4�7�5�4��5�4���B�1B!�B	�!B*	c�Z�d�}d}|dz
}t|�D]2}|jd|���5t||�dd�ddd��4t||dz�D]7}|jd|���5|j||�d	�ddd��9y#1swY��xYw#1swY�PxYw)
Nc��tjd�g}t|�D]}|jd|�d���|jd�dj	|�S)Nzi
                async def bug():
                    async with (
                    a
                rtrurvrk)rwrxro�append�joinrys   rr{zPSyntaxTestCase.test_async_with_statement_many_context_managers.<locals>.get_code�sY���_�_�&���D�
�1�X�����h�q�c��/�0���K�K��%��7�7�4�=� r#r|r=r}r`rar~rrnr�r�s     r�/test_async_with_statement_many_context_managersz>SyntaxTestCase.test_async_with_statement_many_context_managers�s���		!���#�a�'���|�$�A���� 1�q�d�3�4�����Z��8�5�4�%��|�\�A�%5�6�A���� 1�q�d�3�4��!�!�(�1�+�/R�S�5�4�7�5�4��5�4�r�c�,�d}|j|d�y)Nzw
def func1():
    if a != b:
        raise ValueError

def func2():
    try
        return 1
    finally:
        pass
zexpected ':'r rhs  r�&test_barry_as_flufl_with_syntax_errorsz5SyntaxTestCase.test_barry_as_flufl_with_syntax_errors	s��
��	
���$��/r#c��|jdddd��|jdddd��|jddd	d��y)
Nz	a = 3 \ 4�6unexpected character after line continuation characterr=rZ)rrz1,\#
2�z
fgdfgf
1,\#
2
r/r r!s r�-test_invalid_line_continuation_error_positionz<SyntaxTestCase.test_invalid_line_continuation_error_position	s^�����,�R�!"�1�	�	.�	
���*�R�!"�1�	�	.�	
���0�R�!"�1�	�	.r#c�L�|jdd�|jdd�y)NuA.Ɗ\ r�uA.μ\
zunexpected EOF while parsingr r!s r�-test_invalid_line_continuation_left_recursivez<SyntaxTestCase.test_invalid_line_continuation_left_recursive!	s+��	
���-�R�	T����.�8�	:r#c�:�dD]}|j|dzd|�d���dD]}|jd|�d�d|�d���dD]}|j|dzd|�d	���d
}|j|d�|jdd
�d}|j|d�y)Nz([{z1 + 2�\z' was never closedza = z 1, 2, 3
b=3z)]}zunmatched '\�'zFfunc(
    a=["unclosed], # Need a quote in this comment: "
    b=2,
)
z8parenthesis '\)' does not match opening parenthesis '\['zmatch y:
 case e(e=v,v,z was never closeds.# coding=latin
(aaaaaaaaaaaaaaaaa
aaaaaaaaaaa�z'\(' was never closedr )r�parenrrbs    r�test_error_parenthesisz%SyntaxTestCase.test_error_parenthesis)	s����E����e�g�o��E�7�:L�/M�N���E�����U�G�=�9�R��w�FX�;Y�Z���E����e�g�o��u�g�Q�/G�H����	
���$� \�]����4�6I�J�
C�����!�5�6r#c��|jdd�|jdd�|jdd�|jdd�y)Nz'blechzunterminated string literalz"blechz'''blechz)unterminated triple-quoted string literalz"""blechr r!s r�test_error_string_literalz(SyntaxTestCase.test_error_string_literalB	sF�����(�$A�B����(�$A�B����*�&Q�R����*�&Q�Rr#c�L�|jdd�|jdd�y)Nzprint("Hello")zinvalid non-printable characterswith(0,,):
r r!s r�test_invisible_charactersz(SyntaxTestCase.test_invisible_charactersI	s&�����.�0Q�R����-�/P�Qr#c�"�d}t|dd�y)Nz)
def match(x):
    return 1+1

match(34)
r`ra�rrhs  r�+test_match_call_does_not_raise_syntax_errorz:SyntaxTestCase.test_match_call_does_not_raise_syntax_errorM	�����	��j�&�)r#c�"�d}t|dd�y)Nz'
def case(x):
    return 1+1

case(34)
r`rar�rhs  r�*test_case_call_does_not_raise_syntax_errorz9SyntaxTestCase.test_case_call_does_not_raise_syntax_errorV	r�r#c�,�|jddd��y)Nzcall(
a=1,
a=1
)zkeyword argument repeatedr/r0r r!s r�/test_multiline_compiler_error_points_to_the_endz>SyntaxTestCase.test_multiline_compiler_error_points_to_the_end_	s�����!�'��	�	
r#c�,�d}|j|d�y)Na�
while 1:
 while 2:
  while 3:
   while 4:
    while 5:
     while 6:
      while 8:
       while 9:
        while 10:
         while 11:
          while 12:
           while 13:
            while 14:
             while 15:
              while 16:
               while 17:
                while 18:
                 while 19:
                  while 20:
                   while 21:
                    while 22:
                     while 23:
                      break
rnr r1s  r�)test_syntax_error_on_deeply_nested_blocksz8SyntaxTestCase.test_syntax_error_on_deeply_nested_blocksf	s����2	
���&�"E�Fr#c���ddzdz}dD]I}|j|��5|jtd�5t|d|�ddd�ddd��Ky#1swY�xYw#1swY�bxYw)N�-i���4)ra�evalr&r'ztoo complexr`)r��assertRaisesRegex�MemoryErrorr)rr2rs   r�#test_error_on_parser_stack_overflowz2SyntaxTestCase.test_error_on_parser_stack_overflow�	sb���v���#��.�D����4��(��+�+�K��H��F�J��5�I�)�(�/�H�H��)�(�s"�A$�A�A$�A!�A$�$A-	c�v�d}|jt�5t|dd�ddd�y#1swYyxYw)Nz,d{{{{{{{{{{{{{{{{{{{{{{{{{```{{{{{{{ef f():yr`ra)rgr	rr1s  r�test_deep_invalid_rulez%SyntaxTestCase.test_deep_invalid_rule�	s0��@��
�
�
�{�
+��F�J��/�,�
+�
+�s�/�8)z
<testcase>raNNNNN)*r�
__module__�__qualname__rr"r(r+r-r3r5r8r:rArCrHrJrLrNrPrRrWr[r^rerir�cpython_onlyrqr�r�r�r�r�r�r�r�r�r�r�r�r�r��r#rrr�sW��CG�KO�=�<
�B�/�:�>D�F�.�.�
)�	)�5�5�5�
J�8�
8�
L�
J�
J�
I�@
8�
���E��E�
���T��T�2
���T��T�20�"	.�:�7�2S�R�*�*�
�
���!G��!G�F
���6��6�
���0��0r#rc�L�|jtj��|S)N)�addTest�doctest�DocTestSuite)�loader�tests�patterns   r�
load_testsr��	s��	�M�M�'�&�&�(�)��Lr#�__main__)rr�rw�unittest�testr�TestCaserr�r�mainr�r#r�<module>r�sQ��U�n>
�����y0�X�&�&�y0�x
�
�z���H�M�M�O�r#

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