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_tabnanny.cpython-312.opt-2.pyc

�

'Μg�7���	ddlmZmZddlZddlZddlZddlZddlZddlZddl	m
Z
mZmZm
Z
ddlmZddddd	d
d�ZGd�d
�ZGd�de�ZGd�de�ZGd�de�ZGd�de�ZGd�de�ZGd�de�Zy)�)�TestCase�mockN)�captured_stderr�captured_stdout�
script_helper�findfile)�unlinkzCfruits = [
    "Apple",
    "Orange",
    "Banana",

print(fruits)
zLif True:
    print("hello")
  print("world")
else:
    print("else called")
zIif True:
 	print("hello")
	print("world")
else:
    print("else called")
zNif True:
    print("hello")
    print("world")
else:
    print("else called")
zGdef my_func():
	  print("hello world")
	  if True:
		print("If called")zLdef my_func():
		print("Hello world")
		if True:
	        print("If called"))�incomplete_expression�wrong_indented�nannynag_errored�
error_free�tab_space_errored_1�tab_space_errored_2c�"�eZdZ	dd�Zd�Zd�Zy)�TemporaryPyFileNc� �||_||_y�N)�source_code�dir)�selfr�	directorys   �//usr/local/lib/python3.12/test/test_tabnanny.py�__init__zTemporaryPyFile.__init__Bs��&������c���tjd|jdd��5}|j|j�ddd�j
|_|jS#1swY�&xYw)N�wz.pyF)�moder�suffix�delete)�tempfile�NamedTemporaryFiler�writer�name�	file_path)r�fs  r�	__enter__zTemporaryPyFile.__enter__FsY��
�
(�
(��$�(�(�5��
�
�
�G�G�D�$�$�%�
�������~�~��
�
�s�A%�%A.c�.�t|j�yr)r	r$)r�exc_type�	exc_value�
exc_tracebacks    r�__exit__zTemporaryPyFile.__exit__Ns���t�~�~�r)�N)�__name__�
__module__�__qualname__rr&r+�rrrr?s��5���rrc��eZdZ	d�Zy)�TestFormatWitnessesc��	gd�}|D]F\}}|j||��5|jtj|�|�ddd��Hy#1swY�SxYw)N))�Testzat tab sizes T, e, s, t)r,zat tab size )�tz
at tab size t)z  t  zat tab sizes  ,  , t,  ,  )�words�expected)�subTest�assertEqual�tabnanny�format_witnesses)r�testsr6r7s    r�test_format_witnessesz)TestFormatWitnesses.test_format_witnessesUsV��I�
�� %�O�E�8����E�H��=�� � ��!:�!:�5�!A�8�L�>�=� %�=�=�s�&A�A	N)r-r.r/r=r0rrr2r2Rs��0�Mrr2c��eZdZ	d�Zy)�TestErrPrintc	��	ddgdfdgdfgd�dfgdfg}|D]�\}}|j||��5|jt�5t�5}t	j
|�ddd�|j
j�|�ddd�ddd���y#1swY�<xYw#1swY� xYw#1swY��xYw)	N�first�secondz
first second
zfirst
)���z1 2 3
�
)�	argumentsr7)r8�assertRaises�
SystemExitrr:�errprintr9�getvalue)rr<�argsr7�stderrs     r�
test_errprintzTestErrPrint.test_errprintfs���P��x�
 �"2�3��Y�	�"�
�	�"�
��J�	
��$�N�D�(�����x��@��&�&�z�2�(�*�f� �)�)�4�0�+��$�$�V�_�_�%6��B�3�A�@�$�+�*��3�2��A�@�s;�B7�B+�B	�$(B+�B7�B(
�$B+�+B4�0B7�7C	N)r-r.r/rNr0rrr?r?cs��(�Crr?c��eZdZd�Zy)�TestNannyNagc�n�	tjddd�dddd�ftjddd�dddd�fg}|D]�\}}|j�}|j�}|j	�}|j||d�	�5|j
|d|�ddd�|j||d
��5|j
|d
|�ddd�|j||d�
�5|j
|d|�ddd���y#1swY�txYw#1swY�LxYw#1swY��xYw)Nr�foo�bar)�lineno�msg�line��testmsg�testlinerT)�line_numberr7rU)rUr7rV)rVr7)r:�NannyNag�
get_lineno�get_msg�get_liner8r9)rr<�nannyr7rZrUrVs       r�test_all_methodszTestNannyNag.test_all_methodsxs=��C��!�!�!�U�E�2��U�E�:�
�
�!�!�!�Y�
�;��Y�
�C�
�	
�� %�O�E�8��*�*�,�K��-�-�/�C��>�>�#�D����'�(�8�2D���� � ��(�!3�[�A�����#�����@�� � ��%��#�6�A����4�(�6�2B��C�� � ��&�!1�4�8�D�C� %����A�@��C�C�s$�
D�>D�2D+�D	�D(	�+D4	N)r-r.r/r`r0rrrPrPws��9rrPc�R�eZdZ	d�Zd
d�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
y)�	TestCheckc�n�|jttdtj�dt_y)N�verboser)�
addCleanup�setattrr:rd)rs r�setUpzTestCheck.setUp�s"�������9�h�6F�6F�G���rc�,�	t�5}t�5}tj|�ddd�ddd�|j	j�|�|j	j�|�y#1swY�RxYw#1swY�VxYwr)rrr:�checkr9rK)r�dir_or_file�out�err�stdoutrMs      r�verify_tabnanny_checkzTestCheck.verify_tabnanny_check�sj��	��
�&�/�*;�v��N�N�;�'�+<�
�������*�C�0�������*�C�0�+<�*;��
�
�s!�B
�A>�B
�>B	�B
�
Bc�v�	ttd�5}|j|�ddd�y#1swYyxYw�Nr
�r�SOURCE_CODESrn�rr$s  r�test_correct_filezTestCheck.test_correct_file�s.��;�
�\�,�7�
8�I��&�&�y�1�9�
8�
8���/�8c
���	tj�5}|�d�g}ttd|��}ttd|��}|5}|5}||fD]}|j	|�d���dt
_t�5}t�5}	tj|�ddd�ddd�j�}|D]/}
|j|
��5|j|
|�ddd��1|j	j�d�ddd�ddd�ddd�y#1swY��xYw#1swY��xYw#1swY��xYw#1swY�>xYw#1swY�BxYw#1swYyxYw)Nz: listing directory
r
�rz: Clean bill of health.
rC)rVr,)r �TemporaryDirectoryrrr�appendr:rdrrrirKr8�assertInr9)r�tmp_dir�lines�file1�file2�
file1_path�
file2_pathr$rmrMrVs           r�test_correct_directory_verbosez(TestCheck.test_correct_directory_verbose�s5��	��
(�
(�
*�g��{�"7�8�:�E�#�L��$>�'�R�E�#�L��$>�'�R�E��*�e�z�",�j�!9�I��L�L�I�=�0I�!J�K�":�$%�� �$�&�&�/�2C�v��N�N�7�+�3D�&����*��!�D����4��0��
�
�d�F�3�1�0�"�� � ����!2�B�7�',��	+�
*�3D�2C��&�&��1�0��',�e�����	+�
*�s��1E'�E�
3E�=D7	�D+�D7	�&/E�E�(*E�E�E'�+D4�0D7	�7E
�<E�E�E�E�E�E$	� E'�'E0c���	tj�5}ttd|��5|j	|�ddd�ddd�y#1swY�xYw#1swYyxYw)Nr
rw)r rxrrrrn)rr{s  r�test_correct_directoryz TestCheck.test_correct_directory�sN��O�
�
(�
(�
*�g� ��l�!;�w�O��*�*�7�3�P�+�
*�O�O��+�
*�s!�A�A�A�A	�A�A#c���	ttd�5}d}|�d|��}|jt�5|j	||��ddd�ddd�y#1swY�xYw#1swYyxYw)Nr�Iunindent does not match any outer indentation level (<tokenize>, line 3)
�: Indentation Error: �rl�rrrrHrIrn�rr$rls   r�test_when_wrong_indentedz"TestCheck.test_when_wrong_indented�sm��P�
�\�*:�;�
<�	�*�C��M�!6�s�e�<�C��"�"�:�.��*�*�9�#�*�>�/�	=�
<�/�.��	=�
<��"�A$�A�A$�A!	�A$�$A-c���	ttd�5}d}|�d|��}|jt�5|j	||��ddd�ddd�y#1swY�xYw#1swYyxYw)Nr
z(('EOF in multi-line statement', (7, 0))
z: Token Error: r�r�r�s   r�test_when_tokenize_tokenerrorz'TestCheck.test_when_tokenize_tokenerror�sl��S�
�\�*A�B�
C�y�=�C��M����6�C��"�"�:�.��*�*�9�#�*�>�/�D�
C�/�.��D�
C�r�c��	ttd�5}|�d�}|dz
}|dz
}dt_|j	||��ddd�y#1swYyxYw)Nrz': *** Line 3: trouble in tab city! ***
z#offending line: '\tprint("world")'
z3inconsistent use of tabs and spaces in indentation
rC�rk)rrrr:rdrn�rr$rks   r� test_when_nannynag_error_verbosez*TestCheck.test_when_nannynag_error_verbose�sc��	��\�*<�=�
>�)��M�!I�J�C��<�<�C��I�I�C� �H���&�&�y�c�&�:�
?�
>�
>�s�.A�Ac��	ttd�5}|�d�}|j||��ddd�y#1swYyxYw)Nrz 3 '\tprint("world")'
r�rqr�s   r�test_when_nannynag_errorz"TestCheck.test_when_nannynag_error�sA��Q�
�\�*<�=�
>�)��K�9�:�C��&�&�y�c�&�:�?�
>�
>�s�6�?c��	d}|�dtj�dtjtj��d|�d�}|j	t
�5|j
||��ddd�y#1swYyxYw)Nz
no_file.pyz: I/O Error: [Errno z] z: rFr�)�errno�ENOENT�os�strerrorrHrIrn)r�pathrls   r�test_when_no_filezTestCheck.test_when_no_file�sk��D�����-�e�l�l�^�2����U�\�\�*�+�2�d�X�R�9��
�
�
�z�
*��&�&�t��&�5�+�
*�
*�s�A3�3A<c	��	tj�5}ttd|��}ttd|��}|5}|5}d}|�d|��}|j	t
�5|j
||��ddd�ddd�ddd�ddd�y#1swY�"xYw#1swY�&xYw#1swY�*xYw#1swYyxYw)Nrrwr
r�r�r�)r rxrrrrHrIrn)rr{�
error_file�	code_file�e_file�c_filerls       r�test_errored_directoryz TestCheck.test_errored_directory�s���M�
�
(�
(�
*�g�(��-�.�'��J�(��\�*�g��I��v�y�F�6���
�"7��u�=���&�&�z�2��.�.�w�C�.�@�3�	(1��+�
*�3�2��	(1�y�����+�
*�sS�+B<�B0�B$�#B	�7B$�?B0�B<�B!
�B$�$B-�)B0�0B9	�5B<�<CN)r,r,)r-r.r/rgrnrtr�r�r�r�r�r�r�r�r0rrrbrb�s=��#��1�2�
8�04�?�?�;�;�6�Arrbc�D�eZdZ	ejd�d��Zd�Zy)�TestProcessTokensztabnanny.NannyNagc�.�	ttd�5}t|�5}tjtj|j��ddd�|j|j�ddd�y#1swY�-xYw#1swYyxYwrp)
rrr�openr:�process_tokens�tokenize�generate_tokens�readline�assertFalse�called)r�MockNannyNagr$r%s    r�test_with_correct_codez(TestProcessTokens.test_with_correct_code	sj��K�
�\�,�7�
8�I��i��A��'�'��(@�(@����(L�M�!����\�0�0�1�9�
8� ���9�
8�s"�B�3A?�#B�?B	�B�Bc
��	dD]�}|j|��5tt|�5}t|�5}t	j
|j�}|jtj�5tj|�ddd�ddd�ddd�ddd���y#1swY�$xYw#1swY�(xYw#1swY�,xYw#1swY��xYw)N)rr)�key)r8rrrr�r�r�r�rHr:r[r�)rr�r$r%�tokenss     r�test_with_errored_codes_samplesz1TestProcessTokens.test_with_errored_codes_sampless���L�B�C����#��&�$�\�#�%6�7�9��i��A�!)�!9�!9�!�*�*�!E��!�.�.�x�/@�/@�A�$�3�3�F�;�B�)�8�'�&�B�
B�A��)���8�7��'�&�sQ�C�C�?B<	�7B0�
B<	�C�C�0B9�5B<	�<C
�C�C�
C�C	N)r-r.r/r�patchr�r�r0rrr�r�s(��.��T�Z�Z�#�$�2�%�2�<rr�c�D�eZdZ	ddddd�d�Zd�Zd�Zd�Zd�Zd	�Zd
�Z	y)�TestCommandLiner,F)rmrM�partial�expect_failurec�h�	|rtjddg|���\}}}ntjddg|���\}}}tj|�}tj|�}|rd||f||ffD]X\}	}
|
j�}|	j�D]0}|j
||��5|j||�ddd��2�Zy|j|j�|j��|j|j�|j��y#1swY��xYw)Nz-mr:)�std�output)	r�assert_python_failure�assert_python_okr��fsdecode�
splitlinesr8rz�assertListEqual)
rrmrMr�r�rL�_rkrlr�r��_output�_stds
             r�validate_cmdzTestCommandLine.validate_cmd's��P��'�=�=�d�J�V�QU�V�K�A�s�C�'�8�8��z�Q�D�Q�K�A�s�C��k�k�#����k�k�#����!'��
���}�=���V� �+�+�-���N�N�,�D����$�w��?��
�
�d�G�4�@�?�-� >�
� � ����!1�6�3D�3D�3F�G�� � ����!1�6�3D�3D�3F�G�	@�?�s�+D(�(D1c��	ttd�5}|�d�}|dz
}|j||d��ddd�y#1swYyxYw)Nrr�zFunindent does not match any outer indentation level (<string>, line 3)T�rMr��rrrr�)rr$rMs   r�test_with_errored_filez&TestCommandLine.test_with_errored_file;sR��F�
�\�*:�;�
<�	�"�
�%:�;�F��-�
.�F����i��t��L�	=�
<�
<�s	�<�Ac�v�	ttd�5}|j|�ddd�y#1swYyxYwrpr�rss  r�test_with_error_free_filez)TestCommandLine.test_with_error_free_fileCs.��O�
�\�,�7�
8�I����i�(�9�
8�
8�ruc�N�	td�}d|�d�}|j|d��y)Nztabnanny.pyzUsage: z [-v] file_or_directory ...Tr�)rr�)rr�rMs   r�test_command_usagez"TestCommandLine.test_command_usageHs1��3��
�&���4�&� ;�<��������=rc��	ttd�5}|�d�}|jd||��ddd�y#1swYyxYw)NrrFz-q)rmr�)rr$rms   r�test_quiet_flagzTestCommandLine.test_quiet_flagNsB��8�
�\�*<�=�
>�)�!�{�"�%�F����d�I�f��=�?�
>�
>�s	�7�Ac���	ttd�5}tjd�j	�}|jd||d��ddd�y#1swYyxYw)Nr�"offending line: '\tprint("world")'z-vT�rmr��rrr�textwrap�dedent�stripr��rr�rms   r�test_verbose_modez!TestCommandLine.test_verbose_modeTsU��J�
�\�*<�=�
>�$��_�_�7���e�g�
�
���d�D����F�	?�
>�
>���9A�Ac���	ttd�5}tjd�j	�}|jd||d��ddd�y#1swYyxYw)Nrr�z-vvTr�r�r�s   r�test_double_verbose_modez(TestCommandLine.test_double_verbose_mode\sU��P�
�\�*<�=�
>�$��_�_�7���e�g�
�
���e�T�&�$��G�	?�
>�
>�r�N)
r-r.r/r�r�r�r�r�r�r�r0rrr�r�$s6��5�)+�B��V[�H�(M�)�
>�>�G�Hrr�)�unittestrrr�r�r:r�r r��test.supportrrrr�test.support.os_helperr	rrrr2r?rPrbr�r�r0rr�<module>r�s����
$��	�����$�$�)�
	�	%�	%�	%�	!�	'�K*��Z��&M�(�M�"C�8�C�(9�8�9�6qA��qA�h<��<�<>H�h�>Hr

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