Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.12/test/test_lib2to3/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.12/test/test_lib2to3/__pycache__/test_main.cpython-312.opt-1.pyc

�

)Μgl��R�ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
ejjejje�d�Zejjed�ZGd�dej"�Zedk(rej�yy)�N)�main�datazpy2_test_grammar.pyc�<�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
y	)
�TestMainc��d|_y�N)�temp_dir��selfs �8/usr/local/lib/python3.12/test/test_lib2to3/test_main.py�setUpzTestMain.setUps	����
�c��tjjdd�=|jr t	j
|j�yyr)�logging�root�handlersr	�shutil�rmtreer
s r�tearDownzTestMain.tearDowns0���L�L�!�!�!�$��=�=��M�M�$�-�-�(�rc�`�tj}tj}tj}|t_|t_|t_	t	jd|�|t_|t_|t_S#|t_|t_|t_wxYw)Nz
lib2to3.fixes)�sys�stdin�stdout�stderrr)r�args�
in_capture�out_capture�err_capture�
save_stdin�save_stdout�save_stderrs        r�run_2to3_capturezTestMain.run_2to3_capturess���Y�Y�
��j�j���j�j����	� ��
� ��
�	%��9�9�_�d�3�"�C�I�$�C�J�$�C�J��#�C�I�$�C�J�$�C�J�s�B
�
#B-c��tjd�}tj�}tjd�|�}tj�}|jdg|||�}|j
|d�|j�jd�}|jd|�|jd|j��y)Nuprint 'nothing'
print u'über'
�ascii�-rz-print 'nothing'z9WARNING: couldn't encode <stdin>'s diff for your terminal)
�io�StringIO�BytesIO�codecs�	getwriterr"�assertEqual�getvalue�decode�assertIn)r�input_stream�out�out_enc�err�ret�outputs       r�test_unencodable_diffzTestMain.test_unencodable_diff,s����{�{�#F�G���j�j�l��+�&�"�"�7�+�C�0���k�k�m���#�#�S�E�<��#�F������a� �����&�&�w�/���
�
�(�&�1��
�
�&�'*�|�|�~�	7rc�`�tj�|_tjj|jd�|_tjj|jd�|_tj|j�tj|j�g|_	ttjj|jd�d�j�|jjd�tjt|j�|jjtjj!t��tjj|jd�|_tjj|jd�|_t|j"d�5}|j'd�ddd�|jjd�y#1swY�%xYw)z5Setup a test source tree and output destination tree.�python2_project�python3_projectz__init__.py�wz
trivial.pyz#print 'I need a simple conversion.'N)�tempfile�mkdtempr	�os�path�join�py2_src_dir�py3_dest_dir�mkdir�setup_files�open�close�appendr�copy�PY2_TEST_MODULE�basename�trivial_py2_file�
init_py2_file�write)r�trivials  r�setup_test_source_treesz TestMain.setup_test_source_trees8sd�� �(�(�*��
��7�7�<�<��
�
�7H�I����G�G�L�L����8I�J���
����!�!�"�
����"�"�#�����R�W�W�\�\�$�*�*�M�
:�C�@�F�F�H������
�.����O�T�%5�%5�6��������� 0� 0�� A�B� "�����T�-=�-=�|� L����W�W�\�\�$�*:�*:�M�J���
�$�'�'��
-���M�M�?�@�.�������-�.�
-�s�.H$�$H-c�0��|j�tj�}tj�}d�|jdd�ddd|j|j
gtjd�||�}|j
|d�|j�}|jd	|�|jd
|j�d|j
�d�|�|j
t�fd
�|jD��ttj|j���|jD]m}|jdtjj|j
|��dtjj|j|�z���|��otj tj"�}|j%|dj'd|��|j)|dj'd|��y)z92to3 a single directory with a new output dir and suffix.�TEST�-nz--add-suffix�--write-unchanged-files�
--no-diffs�--output-dir�rz implies -w.�
Output in �! will mirror the input directory � layoutc3�(�K�|]	}|�z���y�wr�)�.0�name�suffixs  �r�	<genexpr>zGTestMain.test_filename_changing_on_output_single_dir.<locals>.<genexpr>\s�����F�5E�T�T�&�[�5E�s�zWriting converted z to zNo changes to .*/__init__\.py�/zNo changes to .*/trivial\.pyN)rMr&r'r"r@r?r+r,r.�setrBr<�listdirr=r>�re�escape�sep�assertRegex�replace�assertNotRegex)rr0r2r3rr[rcr\s       @r�+test_filename_changing_on_output_single_dirz4TestMain.test_filename_changing_on_output_single_dirKs�����$�$�&��k�k�m���k�k�m�����#�#��~�v�/H��~��"�"�D�$4�$4�6����B���c�	+��
	
����a� �������
�
�n�f�-��
�
��)�)�4�+;�+;�=�>D�	F�	
����F�T�5E�5E�F�F��R�Z�Z��(9�(9�:�;�	=��$�$�D��M�M��G�G�L�L��!1�!1�4�8��G�G�L�L��!2�!2�D��K�@�B�CI�
K�%��i�i����������8�@�@��c�J�	L�����7�?�?��S�I�	Krc�F�|j�tj�}|j|jg}td�|D��}|j
ddddd|jg|ztjd�tj�|�}|j|d�|j�}|jd	|j�d
|j�d�|�|j|ttj|j���y)
z62to3 two files in one directory with a new output dir.c3�ZK�|]#}tjj|����%y�wr)r<r=rH)rZr[s  rr]zFTestMain.test_filename_changing_on_output_two_files.<locals>.<genexpr>ms ����J�	��R�W�W�-�-�d�3�	�s�)+rP�-wrQrRrSrTrrUrVrWN)rMr&r'rIrJr_r"r@r+r,r.r?r<r`)rr2�	py2_files�expected_filesr3rs      r�*test_filename_changing_on_output_two_filesz3TestMain.test_filename_changing_on_output_two_fileshs����$�$�&��k�k�m���*�*�D�,>�,>�?�	��J�	�J�J���#�#��t�6��~�t�/@�/@�B�DM�N����B�������5��	
����a� �������
�
��)�)�4�+;�+;�=�>D�	F�	
�����R�Z�Z��8I�8I�-J�)K�Lrc�b�|j�tj�}|jdddd|j|j
gtjd�tj�|�}|j
|d�|j�}|jd|j�d|j�d	�|�|j
ttjj|j
�g�ttj|j���y
)z)2to3 a single file with a new output dir.rPrjrRrSrTrrUrVrWN)rMr&r'r"r@rIr+r,r.r?r_r<r=rHr`)rr2r3rs    r�,test_filename_changing_on_output_single_filez5TestMain.test_filename_changing_on_output_single_fileys����$�$�&��k�k�m���#�#��t�\�>�4�;L�;L��&�&�(����B�������5��	
����a� �������
�
��)�)�4�+;�+;�=�>D�	F�	
����b�g�g�.�.�t�/D�/D�E�F�G��R�Z�Z��(9�(9�:�;�	=rN)�__name__�
__module__�__qualname__r
rr"r5rMrgrmrorYrrrrs,���)�%�
7�.�&K�:M�"=rr�__main__)r)r&rr<rarrr:�unittest�lib2to3rr=r>�dirname�__file__�
TEST_DATA_DIRrG�TestCaserrprYrr�<module>rzs���
�	��	�	�
�
���������R�W�W�_�_�X�6��?�
��'�'�,�,�}�.C�D��t=�x� � �t=�n�z���H�M�M�O�r

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