HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.10/lib2to3/tests/__pycache__/test_main.cpython-310.opt-1.pyc
o

�il�@s�ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
ej�ej�
e�d�Zej�ed�ZGdd�dej�ZedkrOe�
�dSdS)�N)�main�datazpy2_test_grammar.pyc@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�TestMaincCs
d|_dS�N)�temp_dir��self�r	�4/usr/local/lib/python3.10/lib2to3/tests/test_main.py�setUps
zTestMain.setUpcCs(tjjdd�=|jrt�|j�dSdSr)�logging�root�handlersr�shutil�rmtreerr	r	r
�tearDowns�zTestMain.tearDowncCsZtj}tj}tj}|t_|t_|t_zt�d|�W|t_|t_|t_S|t_|t_|t_w)Nz
lib2to3.fixes)�sys�stdin�stdout�stderrr)r�argsZ
in_captureZout_captureZerr_captureZ
save_stdinZsave_stdoutZsave_stderrr	r	r
�run_2to3_captures�zTestMain.run_2to3_capturecCstt�d�}t��}t�d�|�}t��}|�dg|||�}|�|d�|���d�}|�	d|�|�	d|���dS)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)rZinput_stream�outZout_enc�err�ret�outputr	r	r
�test_unencodable_diff,s
�zTestMain.test_unencodable_diffcCs�t��|_tj�|jd�|_tj�|jd�|_t�|j�t�|j�g|_	t
tj�|jd�d���|j	�d�t
�t|j�|j	�tj�t��tj�|jd�|_tj�|jd�|_t
|jd��
}|�d�Wd�n1srwY|j	�d�dS)z5Setup a test source tree and output destination tree.Zpython2_projectZpython3_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)rZtrivialr	r	r
�setup_test_source_trees8s 
�z TestMain.setup_test_source_treesc
s|��t��}t��}d�|�dd�ddd|j|jgt�d�||�}|�|d�|��}|�d	|�|�d
|j|jf|�|�t	�fdd�|j
D��t	t�|j���|j
D]}|�d
tj
�|j|�tj
�|j|��f|�qXt�tj�}|�|d�d|��|�|d�d|��dS)z92to3 a single directory with a new output dir and suffix.ZTEST�-nz--add-suffix�--write-unchanged-files�
--no-diffs�--output-dir�rz implies -w.�6Output in %r will mirror the input directory %r layoutc3s�|]}|�VqdSrr	��.0�name��suffixr	r
�	<genexpr>\s�zGTestMain.test_filename_changing_on_output_single_dir.<locals>.<genexpr>zWriting converted %s to %szNo changes to .*/__init__\.py�/zNo changes to .*/trivial\.pyN)r;rrrr/r.rr r"�setr1r+�listdirr,r-�re�escape�sepZassertRegex�replaceZassertNotRegex)rr#r$r%rrDrMr	rEr
�+test_filename_changing_on_output_single_dirKsJ�����
����z4TestMain.test_filename_changing_on_output_single_dircCs�|��t��}|j|jg}tdd�|D��}|�ddddd|jg|t�d�t��|�}|�|d	�|�	�}|�
d
|j|jf|�|�|tt�
|j���dS)z62to3 two files in one directory with a new output dir.css�|]	}tj�|�VqdSr)r+r,r7rBr	r	r
rGms�zFTestMain.test_filename_changing_on_output_two_files.<locals>.<genexpr>r<�-wr=r>r?r@rrAN)r;rrr8r9rIrr/rr r"r.r+rJ)rr$Z	py2_filesZexpected_filesr%rr	r	r
�*test_filename_changing_on_output_two_fileshs*�����z3TestMain.test_filename_changing_on_output_two_filescCs�|��t��}|�dddd|j|jgt�d�t��|�}|�|d�|��}|�d|j|j	f|�|�t
tj�
|j�g�t
t�|j���dS)	z)2to3 a single file with a new output dir.r<rPr>r?r@rrAN)r;rrrr/r8rr r"r.rIr+r,r7rJ)rr$r%rr	r	r
�,test_filename_changing_on_output_single_fileys&�����z5TestMain.test_filename_changing_on_output_single_fileN)�__name__�
__module__�__qualname__rrrr'r;rOrQrRr	r	r	r
rsr�__main__)rrrr+rKrrr)ZunittestZlib2to3rr,r-�dirname�__file__Z
TEST_DATA_DIRr6ZTestCaserrSr	r	r	r
�<module>s w�