Uname: Linux web3.us.cloudlogin.co 5.10.226-xeon-hst #2 SMP Fri Sep 13 12:28:44 UTC 2024 x86_64
Software: Apache
PHP version: 8.1.31 [ PHP INFO ] PHP os: Linux
Server Ip: 162.210.96.117
Your Ip: 3.149.232.145
User: edustar (269686) | Group: tty (888)
Safe Mode: OFF
Disable Function:
NONE

name : test_fileinput.pyo
�
?��cc@sdZddlZddlmZmZmZddlmZmZddl	Z	ddl
Z
ddlmZddlm
Z
mZdd�Zd	�Zd
dd��YZdejfd
��YZdejfd��YZdejfd��YZd�Zedkre�ndS(s,
Tests for fileinput module.
Nick Mathewson
i����N(tverbosetTESTFNtrun_unittest(tunlinktcheck_warnings(tStringIO(t	FileInputthook_encodedtwcCs:tt|�}t||�}|j|�|j�|S(N(Rtstrtopent
writelinestclose(titlinestmodetnametf((s:/usr/local/python-2.7/lib/python2.7/test/test_fileinput.pytwriteTmps


cGsx|D]}t|�qWdS(N(tsafe_unlink(tnamesR((s:/usr/local/python-2.7/lib/python2.7/test/test_fileinput.pytremove_tempfiless
t
LineReadercBsJeZd�Zed��Zd�Zdd�Zdd�Zd�Z	RS(cCs
g|_dS(N(t
_linesread(tself((s:/usr/local/python-2.7/lib/python2.7/test/test_fileinput.pyt__init__!scCsz|jSWdg|_XdS(N(R(R((s:/usr/local/python-2.7/lib/python2.7/test/test_fileinput.pyt	linesread$scCst|jt��|_|S(N(titert
splitlinestTruetit(RtfilenameR((s:/usr/local/python-2.7/lib/python2.7/test/test_fileinput.pytopenhook+scCs&t|jd�}|jj|�|S(Nt(tnextRRtappend(Rtsizetline((s:/usr/local/python-2.7/lib/python2.7/test/test_fileinput.pytreadline/si����cCs`g}d}xMtr[|j�}|s+|S|j|�|t|�7}||kr|SqWdS(Ni(RR&R#tlen(RthintRR$R%((s:/usr/local/python-2.7/lib/python2.7/test/test_fileinput.pyt	readlines4s	
cCsdS(N((R((s:/usr/local/python-2.7/lib/python2.7/test/test_fileinput.pyR@sN(
t__name__t
__module__RtpropertyRR tNoneR&R)R(((s:/usr/local/python-2.7/lib/python2.7/test/test_fileinput.pyRs		tBufferSizesTestscBs eZd�Zddd�ZRS(c	CsxddfD]\}}z�tdgtd�D]}d|d^q/�}tdgtd�D]}d|d^q_�}td	gtd
�D]}d|d^q��}tdgtd�D]}d
|d^q��}|j||||||�Wdt||||�Xq
WdS(NiiiisLine %s of file 1
ii
sLine %s of file 2
iisLine %s of file 3
isLine %s of file 4
(ii(ii(Rtrangetbuffer_size_testR(RtroundtbsR
tt1tt2tt3tt4((s:/usr/local/python-2.7/lib/python2.7/test/test_fileinput.pyttest_buffer_sizesDs0000 icCs�tjd�}d|d}tr9d|d|fGHntd||||fd|�}	t|	�}
|	j�|jt|
�d�|j|
d	d
�|j|
dd�|j|	j�d�|j|	j	�|�tr�d
|d|fGHntd||||fd|�}	d}x"|rA|dkrA|	j
�}q W|j|	j	�|�|j|	j�d�|j|	j�d�|j|	j
��|j|	j��tr�d|d|fGHn|	j�|j|	j
�d�|j|	j�d�|	j�tr"d|d|fGHntd||||dfd|�}	tj}zitd�t_t|	�}
|jt|
�d�|j|
dd�|j|	j	�d�|	j�Wd|t_Xtr�d|d	|fGHntd||||fd|�}	|j|	j�d�|j|	j	�d�|	j�|j|	j�d�|j|	j	�d�tr�d|d|fGHntj}
z[td||||fd dd|�}	x#|	D]}|d! j�}|GHq�W|	j�Wd|
t_Xtd||||fd|�}	xj|	D]b}|j|d!d"�|j|d! �}|j|d�|jt|jd��|	j��qW|	j�dS(#NsLINE (\d+) OF FILE (\d+)iis%s. Simple iteration (bs=%s)itfilestbufsizeiisLine 5 of file 1
isLine 1 of file 4
s%s. Status variables (bs=%s)txsLine 6 of file 2
is%s. Nextfile (bs=%s)isLine 1 of file 3
is%s. Stdin (bs=%s)it-s Line 1 of stdin
Line 2 of stdin
i!i sLine 2 of stdin
s<stdin>s%s. Boundary conditions (bs=%s)s%s. Inplace (bs=%s)itinplacei����s
(tretcompileRRtlistRtassertEqualR'tlinenoRR&t
filelinenotassertFalsetisfirstlinetisstdintnextfiletsyststdinRR-tstdouttuppertmatchtassertNotEqualtinttgroup(RR3R4R5R6R2R1tpattstarttfiRtst	savestdint
savestdoutR%tm((s:/usr/local/python-2.7/lib/python2.7/test/test_fileinput.pyR0Ps�!
!

$	
!
	'
	
!
)(R*R+R7R0(((s:/usr/local/python-2.7/lib/python2.7/test/test_fileinput.pyR.Cs	tFileInputTestscBsYeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
RS(	cCsEz*tddg�}tddg�}tddg�}tddg�}td||||f�}|j�}|j|d�|j|j�d�|j|j�d�|j|j�|�|j�}|j|�|j|j�d�|j|j�d�|j|j�|�|j�Wdt	||||�XdS(	NiR!iisThe only line there is.
iR8i(
RRR&R@RARBRRCRR(RR3R4R5R6RQR%((s:/usr/local/python-2.7/lib/python2.7/test/test_fileinput.pyttest_zero_byte_files�s$
cCs�z�tddg�}tddg�}td||f�}t|�}|j|dddd	d
dg�|j|j�d�|j|j�d
�Wdt||�XdS(NisA
B
CisD
E
FR8sA
sB
tCsD
sE
tFii(RRR?R@RBRAR(RR3R4RQR((s:/usr/local/python-2.7/lib/python2.7/test/test_fileinput.pyt%test_files_that_dont_end_with_newline�s"cCs�zqtddg�}tj�}|dkr6d}ntdt||��}t|�}|j|ddg�Wdt|�XdS(NisA
BtasciiR8sA
tB(	RRGtgetfilesystemencodingR-RtunicodeR?R@R(RR3tencodingRQR((s:/usr/local/python-2.7/lib/python2.7/test/test_fileinput.pyttest_unicode_filenames�s	cCs�z�tddg�}tddg�}td||f�}|j|j�d�|j�}|j|j�d�|j�|j|j�d�t|�}|j|j�d�Wdt||�XdS(NisA
BisC
DR8i����(	RRR@tfilenoR"RLRFR?R(RR3R4RQR%((s:/usr/local/python-2.7/lib/python2.7/test/test_fileinput.pyttest_fileno�s
cCs�y tdd�}|jd�Wntk
r3nXzYtddgdd�}td|dd�}t|�}|j|d	d
ddg�Wdt|�XdS(
NRRs-FileInput should reject invalid mode argumentisA
B
C
DtwbR8tUsA
sB
sC
tD(Rtfailt
ValueErrorRR?R@R(RRQR3R((s:/usr/local/python-2.7/lib/python2.7/test/test_fileinput.pyttest_opening_mode�s
 cCs�y)tdddd��}|jd�Wntk
r<nXy tdd�}|jd�Wntk
rpnXzYtddgdd	�}td
|dtd��}t|�}|j|dd
g�Wdt|�XdS(NR<iR cSsdS(N(R-(RRU((s:/usr/local/python-2.7/lib/python2.7/test/test_fileinput.pyt<lambda>�R!sGFileInput should raise if both inplace and openhook arguments are givens2FileInput should check openhook for being callables+AEE-
+AEI-RRcR8sutf-7uA
uB(RRfRgRRR?R@R(RRQR3R((s:/usr/local/python-2.7/lib/python2.7/test/test_fileinput.pyttest_file_opening_hook�s 

cCs�ttd��2}|jd�|jdd�|jd�WdQX|jtt�tdtdtd��}|j|j�d	�|j|j�d
�|j|j�d�|j	t
��t|�WdQX|j�dS(NRcsA
B
C
s
123456789
i�s�R8R R[uA
uB
uC
(
R
Rtwritet
addCleanupRRRR@R&tassertRaisestUnicodeDecodeErrorR?R(RRRQ((s:/usr/local/python-2.7/lib/python2.7/test/test_fileinput.pyt
test_readlines
cCs$t�}tdddgd|j�}|j|jg�|j|j�d�|j|jdg�|j|j�d�|j|jdg�|j|j�d�|j|jddg�|j|j�d�|j|jdg�|j|j�d�|j|jg�|j�dS(NR8sline1
line2sline3
R sline1
tline2R!(RRR R@RR&R(RtsrcRQ((s:/usr/local/python-2.7/lib/python2.7/test/test_fileinput.pyttest_readline_bufferings	cCst�}tdddgd|j�}|j|jg�|jt|�d�|j|jdg�|jt|�d�|j|jdg�|jt|�d�|j|jddg�|jtt|�|j|jdg�|jtt|�|j|jg�|j�dS(NR8sline1
line2sline3
R sline1
RpR!(	RRR R@RR"Rmt
StopIterationR(RRqRQ((s:/usr/local/python-2.7/lib/python2.7/test/test_fileinput.pyttest_iteration_buffering&s	(R*R+RWRZR`RbRhRjRoRrRt(((s:/usr/local/python-2.7/lib/python2.7/test/test_fileinput.pyRV�s								tTest_hook_encodedcBseZdZd�ZRS(s'Unit tests for fileinput.hook_encoded()cs�ttd��}|jd�WdQX�jtt��fd�}|dddddg�|d	ddddg�|d
ddddg�|dddddg�dS(NRcs
A
B
C
D+IKw-csKtdtd|dtd��}t|�}|j��j||�dS(NR8RR sutf-7(RRRR?RR@(Rtexpected_linesRQR(R(s:/usr/local/python-2.7/lib/python2.7/test/test_fileinput.pytcheck?s

truA
uB
uC
uD€trURdtrb(R
RRkRlR(RRRw((Rs:/usr/local/python-2.7/lib/python2.7/test/test_fileinput.pyt
test_modes9s(R*R+t__doc__R{(((s:/usr/local/python-2.7/lib/python2.7/test/test_fileinput.pyRu6scCstttt�dS(N(RR.RVRu(((s:/usr/local/python-2.7/lib/python2.7/test/test_fileinput.pyt	test_mainKst__main__((R|tunittestttest.test_supportRRRRRRRGR=Rt	fileinputRRRRRtTestCaseR.RVRuR}R*(((s:/usr/local/python-2.7/lib/python2.7/test/test_fileinput.pyt<module>s		$Z�	
© 2025 GrazzMean