Your IP : 216.73.216.213


Current Path : /opt/alt/python39/lib64/python3.9/test/test_tools/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/test/test_tools/__pycache__/test_fixcid.cpython-39.pyc

a

XC?h��@spdZddlmZddlZddlZddlZddlZddlmZddl	m
Z
mZddlZe
�Gdd�dej
�ZdS)zTest Tools/scripts/fixcid.py.�)�StringION)�support)�skip_if_missing�
scriptsdirc@s6eZdZdd�Zdd�Zdd�Zddd	d
�dd�Zd
S)�Testc	Cs<d}d}|�||�}d}d}|�|dj||||d��dS)Nzint xx = "xx\"xx"[xx];
zint xx = 'x\'xx' + xx;
zint yy = "xx\"xx"[yy];
zint yy = 'x\'xx' + yy;
z01
< {old1}> {new1}{new1}2
< {old2}> {new2}{new2})�old1�old2�new1�new2)�
run_script�assertMultiLineEqual�format)�selfrr�outputr	r
�r�@/opt/alt/python39/lib64/python3.9/test/test_tools/test_fixcid.py�test_parse_stringss��zTest.test_parse_stringscCs |jdddd�}|�|d�dS)Nz
xx yy
*aa bb
)z-c�-z4/* xx altered */
int xx;
/* aa unaltered */
int aa;
)�	substfile�args�inputz�1
< /* xx altered */
> /* yy altered */
/* yy altered */
2
< int xx;
> int yy;
int yy;
/* aa unaltered */
4
< int aa;
> int bb;
int bb;
)rr)rrrrr�test_alter_commentss��zTest.test_alter_commentscCs�t�tj�|�tjtj�tj�tjd�}t|d��}|�	d�Wd�n1sV0Yttj�tjd�d��}|�	d�Wd�n1s�0Ytj�t
d�}|jtjfd�}|�|d�
|��dS)	Nzfile.c�wzint xx;
zfile.pyzxx = 'unaltered'
�	fixcid.py)rz{}:
1
< int xx;
> int yy;
)�os�mkdirr�TESTFN�
addCleanupZrmtree�path�join�open�writerrrr
)rZ
c_filename�file�scriptrrrr�test_directory;s((��zTest.test_directory�)rzxx yy
)rrc
Csptjd}t|d��}|�|�Wd�n1s40Y|�tj|�dd|gt|�}tj�	t
d�}t�td|���t�tdt
|����t���~}t���Vztj|dd�Wn2ty�}	z|�|	jd	�WYd}	~	n
d}	~	00Wd�n1s�0YWd�n1�s0YWd�n1�s>0YWd�n1�s^0Y|��S)
Nz.substrrz-s�argv�stdin�__main__)Zrun_namer)rrr r!r�unlink�listrrrrZ	swap_attr�sysrZcaptured_stdoutZcaptured_stderr�runpyZrun_path�
SystemExitZassertEqual�code�getvalue)
rrrrZ
substfilenamer"r&r#r�exitrrrrLs&
(����zTest.run_scriptN)r%)�__name__�
__module__�__qualname__rrr$rrrrrr
sr)�__doc__�iorrZos.pathr,r+�testrZtest.test_toolsrrZunittestZTestCaserrrrr�<module>s