Your IP : 216.73.216.213


Current Path : /opt/alt/python35/lib64/python3.5/test/test_tools/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/test/test_tools/__pycache__/test_fixcid.cpython-35.pyc



��Yf��@s�dZddlmZddlZddlZddlZddlZddlmZddl	m
Z
mZddlZe
�Gdd�dej
�ZdS)zTest Tools/scripts/fixcid.py.�)�StringION)�support)�skip_if_missing�
scriptsdirc@sOeZdZdd�Zdd�Zdd�Zdddd
ddd
�ZdS)�TestcCs]d}d}|j||�}d}d}|j|djd|d|d|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/python35/lib64/python3.5/test/test_tools/test_fixcid.py�test_parse_stringss		zTest.test_parse_stringscCs2|jdddd	dd�}|j|d�dS)
N�	substfilez
xx yy
*aa bb
�args�-c�-�inputz4/* xx altered */
int xx;
/* aa unaltered */
int aa;
z�1
< /* xx altered */
> /* yy altered */
/* yy altered */
2
< int xx;
> int yy;
int yy;
/* aa unaltered */
4
< int aa;
> int bb;
int bb;
)rr)rr)rrrrr�test_alter_commentss			zTest.test_alter_commentscCs�tjtj�|jtjtj�tjjtjd�}t|d��}|j	d�WdQRXttjjtjd�d��}|j	d�WdQRXtjjt
d�}|jdtjf�}|j|dj
|��dS)	Nzfile.c�wzint xx;
zfile.pyzxx = 'unaltered'
z	fixcid.pyrz{}:
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�rrrzxx yy
c
3Cs:tjd}t|d��}|j|�WdQRX|jtj|�dd|gt|�}tjj	t
d�}tjtd|���tjtdt
|����tj��m}tj��Wytj|dd�Wn8tk
r}	z|j|	jd	�WYdd}	~	XnXWdQRXWdQRXWdQRXWdQRX|j�S)
Nz.substrz	fixcid.pyz-s�argv�stdinZrun_name�__main__r)rrr r!r�unlink�listrrrrZ	swap_attr�sysrZcaptured_stdoutZcaptured_stderr�runpyZrun_path�
SystemExitZassertEqual�code�getvalue)
rrrrZ
substfilenamer"r&r#r�exitrrrrLs

BzTest.run_scriptN)r)�__name__�
__module__�__qualname__rrr$rrrrrr
sr)�__doc__�iorrZos.pathr,r+ZtestrZtest.test_toolsrrZunittestZTestCaserrrrr�<module>s