HEX
Server: LiteSpeed
System: Linux server.nevid-deploma.com 4.18.0-553.111.1.lve.el8.x86_64 #1 SMP Fri Mar 13 13:42:17 UTC 2026 x86_64
User: smilepac (1037)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //opt/cppython/lib/python3.8/test/test_tools/__pycache__/test_fixcid.cpython-38.opt-1.pyc
U

1D�g��@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/cppython/lib/python3.8/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_commentsc	Cs�t�tj�|�tjtj�tj�tjd�}t|d��}|�	d�W5QRXttj�tjd�d��}|�	d�W5QRXtj�t
d�}|jtjfd�}|�|d�
|��dS)	Nzfile.c�wzint xx;
zfile.pyzxx = 'unaltered'
�	fixcid.py)rz{}:
1
< int xx;
> int yy;
)�os�mkdirr�TESTFN�
addCleanup�rmtree�path�join�open�writerrrr
)rZ
c_filename�file�scriptrrrr�test_directory;s��zTest.test_directory�)rzxx yy
)rrc
Cstjd}t|d��}|�|�W5QRX|�tj|�dd|gt|�}tj�	t
d�}t�td|���t�tdt
|���rt���^}t���Jztj|dd�Wn0tk
r�}	z|�|	jd	�W5d}	~	XYnXW5QRXW5QRXW5QRXW5QRX|��S)
Nz.substrrz-s�argv�stdin�__main__)Zrun_namer)rrr!r"r�unlink�listrrr rZ	swap_attr�sysrZcaptured_stdoutZcaptured_stderr�runpyZrun_path�
SystemExitZassertEqual�code�getvalue)
rrrrZ
substfilenamer#r'r$r�exitrrrrLs&
���HzTest.run_scriptN)r&)�__name__�
__module__�__qualname__rrr%rrrrrr
sr)�__doc__�iorrZos.pathr-r,�testrZtest.test_toolsrrZunittestZTestCaserrrrr�<module>s