python (3.12.0)

(root)/
lib/
python3.12/
test/
__pycache__/
test_fileinput.cpython-312.opt-2.pyc

͑ejf	ddlZddlZddlZddlZddlZddlZddlZddlZddlZ	ddl	Z		ddlZddlmZm
Z
ddlmZmZddlmZddlmZddlmZddlmZddlmZdd	lmZdd
lmZGddZGd
dZGddeej<ZGddZ Gddeej<Z!GddZ"Gddej<Z#Gdde#Z$Gdde#Z%Gdde#Z&Gdd e#Z'Gd!d"e#Z(Gd#d$e#Z)Gd%d&e#Z*Gd'd(e#Z+Gd)d*e#Z,Gd+d,Z-Gd-d.ej<Z.Gd/d0ej<Z/Gd1d2ej<Z0e1d3k(rejdyy#e
$rdZ	YvwxYw#e
$rdZYwxYw)4N)BytesIOStringIO)	FileInputhook_encoded)Path)verbose)TESTFN)unlink)	os_helper)support)mockceZdZdddZy)	BaseTestswmodectj\}}|jtj|d|vrdnd}t|||5}|j
|ddd|S#1swY|SxYw)Nbutf-8encoding)tempfilemkstemp
addCleanuprr
openwrite)selfcontentrfdnamerfs       G/BuggyBox/python/3.12.0/bootstrap/lib/python3.12/test/test_fileinput.pywriteTmpzBaseTests.writeTmp+si##%D	(($/$;4G
"dX
.	!
GGG		sA**A4N)__name__
__module____qualname__r#r"rr(s),r(rc>eZdZdZedZdZddZd	dZdZ	y)

LineReadercg|_yN
_linesreadrs r"__init__zLineReader.__init__5s	r(cH	|jddg|_S#g|_wxYwr,r-r/s r"	linesreadzLineReader.linesread8s"	!??1% DObDOs	!cDt|jd|_|SNT)iter
splitlinesit)rfilenamers   r"openhookzLineReader.openhook?sx**401r(Ncht|jd}|jj||S)N)nextr7r.append)rsizelines   r"readlinezLineReader.readlineCs)DGGR t$r(cg}d}	|j}|s|S|j||t|z
}||k\r|S;Nr)r@r=len)rhintlinesr>r?s     r"	readlineszLineReader.readlinesHsM==?DLLCIDt|r(cyr,r'r/s r"closezLineReader.closeTsr(r,))
r$r%r&r0propertyr2r9r@rFrHr'r(r"r*r*3s/!!


r(r*ceZdZdZy)BufferSizesTestsc|jdjdtdD}|jdjdtdD}|jdjdtdD}|jdjdtd	D}tjd
}t
rt
dt||||fd
}t|}|j|jt|d|j|dd|j|dd|j|jd|j|j|t
rt
dt||||fd
}d}|r|dk7r|j}|r|dk7r|j|j||j|jd|j|jd|j!|j#|j!|j%t
rt
d|j'|j|jd|j|jd|jt
rt
dt||||dfd
}t(j*}		t-dt(_t|}|jt|d|j|dd |j|jd!|j'|	t(_t
rt
d"t||||fd
}|j|jd#|j|jd|j'|j|jd#|j|jdt
rt
d$t(j.}
	t||||fd	d%}|D] }|dd&j1}t
|"|j|
t(_t||||fd
}|D]u}|j|d&d'|j3|dd&}|j5|d|jt7|j9d	|jw|jy#|	t(_wxYw#|
t(_wxYw)(Nr;c3,K|]}d|dzzyw)zLine %s of file 1
Nr'.0is  r"	<genexpr>z5BufferSizesTests.test_buffer_sizes.<locals>.<genexpr>Z"TQ#8AaC#@"Tc3,K|]}d|dzzyw)zLine %s of file 2
rONr'rPs  r"rSz5BufferSizesTests.test_buffer_sizes.<locals>.<genexpr>[rTrU
c3,K|]}d|dzzyw)zLine %s of file 3
rONr'rPs  r"rSz5BufferSizesTests.test_buffer_sizes.<locals>.<genexpr>\"SQ#8AaC#@"SrUc3,K|]}d|dzzyw)zLine %s of file 4
rONr'rPs  r"rSz5BufferSizesTests.test_buffer_sizes.<locals>.<genexpr>]rZrUrOzLINE (\d+) OF FILE (\d+)z1. Simple iterationrfilesrzLine 5 of file 1
zLine 1 of file 4
z2. Status variablesxzLine 6 of file 2
z3. NextfilezLine 1 of file 3
z4. Stdin-z Line 1 of stdin
Line 2 of stdin
! zLine 2 of stdin
z<stdin>z5. Boundary conditionsrz
6. Inplacer^inplacerrI
)r#joinrangerecompilerprintrlistrHassertEqualrClinenor8r@
filelinenoassertFalseisfirstlineisstdinnextfilesysstdinrstdoutuppermatchassertNotEqualintgroup)
rt1t2t3t4patfirEs	savestdin
savestdoutr?ms
             r"test_buffer_sizesz"BufferSizesTests.test_buffer_sizesXsS
]]277"T%PR)"TT
U
]]277"T%PR)"TT
U
]]277"S%PQ("SS
T
]]277"S%PQ("SS
Tjj45'(
b"b"-
@R

UR(q#78r$89b)+'(
b"b"-
@A--
AA--+b)!,)*&- 

(<=b)

*
b"b"c2W
EII		" !EFCIHESZ,U2Y(;<R[[]I6KKM!CI*+
b"b"-
@a(-

a(-,ZZ
	$"b"b!11wOB
CRy(d

HHJ#CJ
b"b"-
@	?DT"Xt,		$s)$A4(S_bmmo>		?
	
;"CI*$CJsA?U*<AU:*
U7:
VN)r$r%r&rr'r(r"rLrLWsPr(rLceZdZdZdZy)UnconditionallyRaisec ||_d|_yNF)exception_typeinvoked)rrs  r"r0zUnconditionallyRaise.__init__s,r(c0d|_|jr4)rrrargskwargss   r"__call__zUnconditionallyRaise.__call__s!!##r(Nr$r%r&r0rr'r(r"rrs$r(rceZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZdZdZdZdZdZdZdZy)FileInputTestsc|jd}|jd}|jd}|jd}t||||fd}|j}|j|d|j|j	d|j|jd|j|j
||j}|j||j|j	d|j|jd|j|j
||jy)Nr;zThe only line there is.
rr]rOr)	r#rr@rrrsrtr8rurH)rrrrrrr?s       r"test_zero_byte_filesz#FileInputTests.test_zero_byte_filess
]]2

]]2

]]6
7
]]2

b"b"-
@{{}:;a(!,+{{}a(!,+

r(c$|jd}|jd}t||fd}t|}|j|gd|j|j	d|j|jdy)NA
B
CD
E
Frr]A
B
CzD
zE
Frd)r#rrqrrrtrsrrrrrEs     r"%test_files_that_dont_end_with_newlinez4FileInputTests.test_files_that_dont_end_with_newlinest
]]9
%
]]9
%
b"X
8R FG!,a(r(c|jd}|jd}t||fd}|j|jdt	|}|j|jd|j
|j|jdt|}|j|jdy)NzA
BzC
Drr]rI)r#rrrfilenor<r~rxrq)rrrrr?s     r"test_filenozFileInputTests.test_filenos
]]6
"
]]6
"
b"X
8b)BxBIIK,

b)Bxb)r(cdD]G}|j|5|jt5t|ddddddIy#1swYxYw#1swY`xYw)N)rrUUr)subTestassertRaises
ValueErrorr)rrs  r"test_invalid_opening_modez(FileInputTests.test_invalid_opening_modesd$	)D4(
)&&z2)4()
)
)	)))
)
)s!A
AAAAA#	ctjd5}td|_t	dgd}t|}|j
|dgdddy#1swYyxYw)Nz	sys.stdinspam, bacon, sausage, and spamrfrbr^r)r
patchrbufferrrqrr)rm_stdinrrEs    r"test_stdin_binary_modez%FileInputTests.test_stdin_binary_modesa
ZZ
$	I$%FGGN#T2BHEU%F$GH		I	I	Is=AA%c.tj}	tdt_|jt	tjdtdgd}t
|}|j|dg|t_y#|t_wxYw)Nrrrfrr)ryrzrruhasattrrrqrr)r
orig_stdinrrEs    r"test_detached_stdin_binary_modez.FileInputTests.test_detached_stdin_binary_modespYY
	# ABCIWSYY9:#T2BHEU%F$GH"CI
CIsA)B
Bc	tdd}|jd	td}|jdGdd}|jd	}|}t|g|5}|j	ddd|j|jd
y#t$rYwxYw#t$rYwxYw#1swYDxYw)NrOcyr,r')r!rs  r"<lambda>z7FileInputTests.test_file_opening_hook.<locals>.<lambda>r()rjr9zGFileInput should raise if both inplace and openhook arguments are givenr9z2FileInput should check openhook for being callableceZdZdZdZy)=FileInputTests.test_file_opening_hook.<locals>.CustomOpenHookcd|_yr)rr/s r"r0zFFileInputTests.test_file_opening_hook.<locals>.CustomOpenHook.__init__s	$r(c&d|_t|ddiS)NTrr)rr)rrkargss   r"rzFFileInputTests.test_file_opening_hook.<locals>.CustomOpenHook.__call__s#T4G44r(Nrr'r(r"CustomOpenHookrs
%
5r(rrkzopenhook not invoked)rfailrr#r@
assertTruer)rrrtcustom_open_hooks     r"test_file_opening_hookz%FileInputTests.test_file_opening_hooks	1/@ABII@
A	A&BIIJK	5	5
MM$)+
s%5
6	"KKM	(002HI'		
				s.B%B4/C%	B10B14	C?CCc:ttd5}|jd|jddz|jdddd|jttttt
d5}	|j|jd|j|jd	|j|jd
|jt5t|ddd|j|jd|j|jddddy#1swYxYw#t$r|jdYwxYw#1swYxYw#1swYyxYw)
NwbsA
B
C
s
123456789
iasciir^r9rrC
zRead to end of filer;)
rr	rrsafe_unlinkrrrrr@UnicodeDecodeErrorrrrqrr!rs   r"
test_readlinezFileInputTests.test_readlinesJ
&$
	1
GGN#
GGNT)*
GGG		
V,
V ,W 57	0:<
1  6  6  6""#56
R

R[[]B/R[[]B/	0	0		&
1		/0
1

	0	0sU7EFA E%&F;FAFE"%F?FFFF	
FFc0ttd5}|jdddd|jttttd5}|j
|jd|j
|jd|j
|jd|j
|jd|j
|jddddy#1swYxYw#1swYyxYw)	NrsA
B
C
DrrsA
sB
sC
Dr()rr	rrrrrrr@rs   r"test_readline_binary_modez(FileInputTests.test_readline_binary_mode2s
&$
	%1
GGO$	%V,
V$
/	12R[[]F3R[[]H5R[[]G4R[[]C0R[[]C0
	1	1		%	%	1	1sDB!DD	Dct|jdd}t|dd5}|j}|j|dtj
j
ddddt|d5}|j|jddddy#1swY?xYw#1swYyxYw)Ns
Initial text.rrrT)rrjs	New line.)	r#rr@rrryr{rrreadr	temp_filefobjr?r!s     r"test_inplace_binary_write_modez-FileInputTests.test_inplace_binary_write_mode?sMM"2M>	
ytT
:	+d==?DT#34JJ\*		+
)T
"	5aQVVX|4	5	5	+	+
	5	5sAB"8!B."B+.B7cl|jdd}t|ddd5}|j}|j|dt	d	dddt|d
5}|j|j
jdddddy#1swYNxYw#1swYyxYw)
NsInitial text rrTrreplace)rjrerrorsuInitial text �uNew line ˆrs
s
New line ?)r#rr@rrrprrrstriprs     r"test_inplace_encoding_errorsz+FileInputTests.test_inplace_encoding_errorsIsMM"6TMB	
y$ '	;	#>B==?DT#89/"		#
)T
"	FaQVVX__W5}E	F	F	#	#
	F	Fs.B%0B*B'*B3cd}|jd}t|g|5}|j}ddd|jdy#1swYxYw)Nc,tjdS)N(I used to receive only filename and mode)iorr8rs  r"old_hookzFFileInputTests.test_file_hook_backward_compatibility.<locals>.old_hookTs;;IJJr(rkrr)r#rr@rr)rrrrresults     r"%test_file_hook_backward_compatibilityz4FileInputTests.test_file_hook_backward_compatibilitySsU	KMM$
sX
.	#"[[]F	#!KL	#	#sAAc|jd}|jd}t||fd5}t|}ddd|jgd|jj	d|j|jd|j|jdy#1swYzxYw)	Nrrrr]rrrdr')r#rrqrrrtrs_filesrs     r"test_context_managerz#FileInputTests.test_context_manager[s
]]9
%
]]9
%
b"X
8	BHE	 FG!,a(B'		sB77Cc|jd}	t|d5}t#1swYyxYw#t$r|jjdYywxYw)Nr;rr]r')r#rOSErrorrrr)rrrs   r"test_close_on_exceptionz&FileInputTests.test_close_on_exceptionesX
]]2
	,g6
"


	,RYY+	,s
3'033%AActgd5}|j|jddddy#1swYyxYw)Nrr])rf)rrrr)rrs  r".test_empty_files_list_specified_to_constructorz=FileInputTests.test_empty_files_list_specified_to_constructorms7
R'
2	0bRYY/	0	0	0s4=c	tj}tt}	|j	d}|jt|dzt|gdd5}t||t_|jddd|t_|j|jdy#1swY1xYw#|t_wxYw)Nrkz.bakTrrizos.unlink() was not invoked)osr
rrr#rrrr<rxrr)ros_unlink_origos_unlink_replacementrrs     r"%test_nextfile_oserror_deleting_backupz4FileInputTests.test_nextfile_oserror_deleting_backupqs	 4W =	'

d#AOOKV4!dWE
R1	


'BI	
-555	7


'BIs#9B>'B2B>2B;7B>>
CcT	tj}tt}	|j	d}t|gdd5}|t_|j
ddd|t_|j|jdy#1swY1xYw#|t_wxYwNrkTrrizos.fstat() was not invoked)	rfstatrrr#rr@rr)r
os_fstat_origos_fstat_replacementrrs     r"%test_readline_os_fstat_raises_OSErrorz4FileInputTests.test_readline_os_fstat_raises_OSError	;
3G<	%

d#A!dWE
/

%BH	
,444	6

%BH# BBBBB
B'cT	tj}tt}	|j	d}t|gdd5}|t_|j
ddd|t_|j|jdy#1swY1xYw#|t_wxYwr)	rchmodrrr#rr@rr)r
os_chmod_origos_chmod_replacementrrs     r"%test_readline_os_chmod_raises_OSErrorz4FileInputTests.test_readline_os_chmod_raises_OSErrorrrcfGddt}|}|jd}t|gd5}|j}	||_|j	}||_	ddd|j|jd|jddy#||_wxYw#1swYExYw)	NceZdZdZdZy)QFileInputTests.test_fileno_when_ValueError_raised.<locals>.FilenoRaisesValueErrorc8tj|tyr,)rr0rr/s r"r0zZFileInputTests.test_fileno_when_ValueError_raised.<locals>.FilenoRaisesValueError.__init__s$--dJ?r(c$|jyr,)rr/s r"rzXFileInputTests.test_fileno_when_ValueError_raised.<locals>.FilenoRaisesValueError.filenos

r(N)r$r%r&r0rr'r(r"FilenoRaisesValueErrorrs

@
 r(rrkrr]z_file.fileno() was not invokedrIzfileno() should return -1)rr#r_filerrrrr)rr unconditionally_raise_ValueErrorrrfile_backuprs       r""test_fileno_when_ValueError_raisedz1FileInputTests.test_fileno_when_ValueError_raiseds	 %9	 ,B+C(MM$
aS7
3	'r((K
';&
	'	
8@@8	:	
%@A
'
	'	's#
B'BB'	B$$B''B0ct}tddg|j5}|j|jg|j|jd|j|jdg|j|jd|j|jdg|j|jd|j|jddg|j|jd|j|jdg|j|jd|j|jgdddy#1swYyxYwNzline1
line2zline3
rzline1
line2r;)r*rr9rrr2r@rsrcrs   r"test_readline_bufferingz&FileInputTests.test_readline_bufferings'l
ni8 #.	013S]]B/R[[]I6S]]YK8R[[]G4S]]WI6R[[]I6S]]RO<R[[]B/S]]RD1R[[]B/S]]B/	0	0	0sEE;;Fct}tddg|j5}|j|jg|jt|d|j|jdg|jt|d|j|jdg|jt|d|j|jddg|j
tt
||j|jdg|j
tt
||j|jgdddy#1swYyxYwr)r*rr9rrr2r<r
StopIterationrs   r"test_iteration_bufferingz'FileInputTests.test_iteration_bufferingsl
ni8 #.	013S]]B/T"Xy1S]]YK8T"Xw/S]]WI6T"Xy1S]]RO<mT26S]]RD1mT26S]]B/	0	0	0sD5E""E+ct|jd}t|d5}|j}|j	|d|j	|jd|j	|j
d|j	|jtj|dddy#1swYyxYw)N
Pathlib file.rrrO)
rr#rr@rrrsrtr8rfspath)rrrr?s    r"test_pathlib_filez FileInputTests.test_pathlib_files
$--0
1
rG
,	;;;=DT?3RYY[!,R]]_a0R[[]BIIbM:	;	;	;sBCCcbt|jd}t|dd5}|j}|j	|dtd|zdddt
|d5}|j	|jddddy#1swY@xYw#1swYyxYw)NrTr)rjrzModified %srzModified Pathlib file.
)rr#rr@rrrprr)rrrr?r!s     r"test_pathlib_file_inplacez(FileInputTests.test_pathlib_file_inplaces
$--0
1
r4'
:	(b;;=DT?3-$&'	("w
'	C1QVVX'AB	C	C		(	(	C	Cs1B/!B%B"%B.N)r$r%r&rrrrrrrrrrrrrrrrrrrrrrrr'r(r"rrs{()(
*)I	#J60.15FM(,07*6$6$B.0 0 ;Cr(rcReZdZ	d
ddddddZdZdZdZdZd	Zd
Z	dZ
dZy)
MockFileInputNr)rr9rrc||_||_||_||_||_||_||_d|_tjd|_
i|_y)NcyrBr'r'r(r"rz(MockFileInput.__init__.<locals>.<lambda>rr()r^rjbackuprr9rrrcollectionsdefaultdictinvocation_counts
return_values)rr^rjr$rr9rrs        r"r0zMockFileInput.__init__sU
	 
 

!,!8!8!Cr(c2|jdxxdz
cc<y)NrHrO)r'r/s r"rHzMockFileInput.closesw'1,'r(cN|jdxxdz
cc<|jdS)NrxrOr'r(r/s r"rxzMockFileInput.nextfile)z*a/*!!*--r(cN|jdxxdz
cc<|jdS)Nr8rOr+r/s r"r8zMockFileInput.filenamer,r(cN|jdxxdz
cc<|jdS)NrsrOr+r/s r"rszMockFileInput.lineno)x(A-(!!(++r(cN|jdxxdz
cc<|jdS)NrtrOr+r/s r"rtzMockFileInput.filelinenos)|,1,!!,//r(cN|jdxxdz
cc<|jdS)NrrOr+r/s r"rzMockFileInput.filenor/r(cN|jdxxdz
cc<|jdS)NrvrOr+r/s r"rvzMockFileInput.isfirstlines)}-2-!!-00r(cN|jdxxdz
cc<|jdS)NrwrOr+r/s r"rwzMockFileInput.isstdins)y)Q.)!!),,r()NFr;)r$r%r&r0rHrxr8rsrtrrvrwr'r(r"r r s@N D4 -..,0,1-r(r c eZdZ	dZdZdZy)BaseFileInputGlobalMethodsTestcvtj|_tj|_t
t_yr,)	fileinput_state_orig_stater_orig_FileInputr r/s r"setUpz$BaseFileInputGlobalMethodsTest.setUp's&$++(22+	r(cX|jt_|jt_yr,)r:r7rr9r8r/s r"tearDownz'BaseFileInputGlobalMethodsTest.tearDown,s"22	++	r(c|j|}|j|d|t|j}|j|dy)NrO)r'rrrC)rmock_file_inputmethod_nameactual_countactual_total_counts     r"assertExactlyOneInvocationz9BaseFileInputGlobalMethodsTest.assertExactlyOneInvocation0sF&88Eq+6 !B!BC+Q/r(N)r$r%r&r;r=rCr'r(r"r5r5#s ,
,0r(r5c&eZdZ	dZdZdZdZy)Test_fileinput_inputcX	t}t|_|t_|jt5}tjddd|jdjj|j|tjdy#1swYQxYw)N)zinput() already activefileinput._state)r objectrr7r8rRuntimeErrorinputrr	exceptionrassertIs)rinstancecms   r"1test_state_is_not_None_and_state_file_is_not_NonezFTest_fileinput_input.test_state_is_not_None_and_state_file_is_not_None;s	$!?#	


|
,	OO	4bll6G6GH

h	 0 02DE		sB  B)c^	t}d|_|t_|j	yr,)r rr7r8do_test_call_inputrrMs  r"-test_state_is_not_None_and_state_file_is_NonezBTest_fileinput_input.test_state_is_not_None_and_state_file_is_NoneHs,	@
!?#	!r(c<	dt_|jyr,)r7r8rQr/s r"test_state_is_Nonez'Test_fileinput_input.test_state_is_NoneSs	
 	!r(c	t}t}t}t}t}t}tj||||||}|j|tjd|j||j
d|j||jd|j||jd|j||jd|j||jdy)N)r^rjr$rr9rrGr^rjr$rr9)
rHr7rJrLr8r^rjr$rr9)rr^rjr$rr9rrs        r"rQz'Test_fileinput_input.do_test_call_input\s	F(x88ugf8=	


fi..0BC	


eV\\73

gv~~y9

ffmmX6

dFKK0

h<r(N)r$r%r&rOrSrUrQr'r(r"rErE8s*F	""=r(rEceZdZ	dZdZy)Test_fileinput_closec	dt_tj|jtjyr,)r7r8rHassertIsNoner/s r"rUz'Test_fileinput_close.test_state_is_Nonezs-		)**+r(c	t}|t_tj|j	|d|jtjy)NrH)r r7r8rHrCrZrRs  r"test_state_is_not_Nonez+Test_fileinput_close.test_state_is_not_NonesD	# ?#	''':)**+r(Nr$r%r&rUr\r'r(r"rXrXws*,,r(rXceZdZ	dZdZy)Test_fileinput_nextfilec"	dt_|jt5}tjddd|jdjj|jtjy#1swYOxYwN)zno active input())	r7r8rrIrxrrrKrrZrrNs  r"rUz*Test_fileinput_nextfile.test_state_is_Noneq	3 	


|
,	! 	!/1B1BC)**+	!	!BBc	t}t}||jd<|t_tj
}|j
|d|j|||jtj|y)Nrx)rHr r(r7r8rxrCrL)rnextfile_retvalrMretvals    r"r\z.Test_fileinput_nextfile.test_state_is_not_Noneo	.!( ?-<z*#	##%''*=

fo.

i&&1r(Nr]r'r(r"r_r_-,2r(r_ceZdZ	dZdZy)Test_fileinput_filenamec"	dt_|jt5}tjddd|jdjj|jtjy#1swYOxYwra)	r7r8rrIr8rrrKrrZrbs  r"rUz*Test_fileinput_filename.test_state_is_Nonercrdc	t}t}||jd<|t_tj
}|j
|d|j|||jtj|y)Nr8)rHr r(r7r8r8rCrL)rfilename_retvalrMrgs    r"r\z.Test_fileinput_filename.test_state_is_not_Nonerhr(Nr]r'r(r"rkrkrir(rkceZdZ	dZdZy)Test_fileinput_linenoc"	dt_|jt5}tjddd|jdjj|jtjy#1swYOxYwra)	r7r8rrIrsrrrKrrZrbs  r"rUz(Test_fileinput_lineno.test_state_is_Noneq	3 	


|
,		/1B1BC)**+		rdc	t}t}||jd<|t_tj
}|j
|d|j|||jtj|y)Nrs)rHr r(r7r8rsrCrL)r
lineno_retvalrMrgs    r"r\z,Test_fileinput_lineno.test_state_is_not_Noneso	.
 ?+8x(#	!!#''(;

fm,

i&&1r(Nr]r'r(r"rprps+,2r(rpceZdZ	dZdZy)Test_fileinput_filelinenoc"	dt_|jt5}tjddd|jdjj|jtjy#1swYOxYwra)	r7r8rrIrtrrrKrrZrbs  r"rUz,Test_fileinput_filelineno.test_state_is_Nonesq	3 	


|
,	#  "	#/1B1BC)**+	#	#rdc	t}t}||jd<|t_tj
}|j
|d|j|||jtj|y)Nrt)rHr r(r7r8rtrCrL)rfilelineno_retvalrMrgs    r"r\z0Test_fileinput_filelineno.test_state_is_not_Nonesq	.#H ?/@|,#	%%''',?

f/0

i&&1r(Nr]r'r(r"rvrvs/,2r(rvceZdZ	dZdZy)Test_fileinput_filenoc"	dt_|jt5}tjddd|jdjj|jtjy#1swYOxYwra)	r7r8rrIrrrrKrrZrbs  r"rUz(Test_fileinput_fileno.test_state_is_Nonerrrdc 	t}t}||jd<||_|t_t	j}|j|d|j|||jtj
|y)Nr)	rHr r(
fileno_retvalr7r8rrCrL)rr~rMrgs    r"r\z,Test_fileinput_fileno.test_state_is_not_Nonesw	.
 ?+8x(!.#	!!#''(;

fm,

i&&1r(Nr]r'r(r"r{r{s+,
2r(r{ceZdZ	dZdZy)Test_fileinput_isfirstlinec"	dt_|jt5}tjddd|jdjj|jtjy#1swYOxYwra)	r7r8rrIrvrrrKrrZrbs  r"rUz-Test_fileinput_isfirstline.test_state_is_Nonesq	3 	


|
,	$!!#	$/1B1BC)**+	$	$rdc	t}t}||jd<|t_tj
}|j
|d|j|||jtj|y)Nrv)rHr r(r7r8rvrCrL)risfirstline_retvalrMrgs    r"r\z1Test_fileinput_isfirstline.test_state_is_not_Nonesq	.$X ?0B}-#	&&(''-@

f01

i&&1r(Nr]r'r(r"rrs0,2r(rceZdZ	dZdZy)Test_fileinput_isstdinc"	dt_|jt5}tjddd|jdjj|jtjy#1swYOxYwra)	r7r8rrIrwrrrKrrZrbs  r"rUz)Test_fileinput_isstdin.test_state_is_None0sq	3 	


|
,	 	 /1B1BC)**+	 	 rdc	t}t}||jd<|t_tj
}|j
|d|j|||jtj|y)Nrw)rHr r(r7r8rwrCrL)risstdin_retvalrMrgs    r"r\z-Test_fileinput_isstdin.test_state_is_not_None:so	.  ?,:y)#	""$'')<

fn-

i&&1r(Nr]r'r(r"rr-s,,2r(rceZdZdZdZy)InvocationRecordercd|_yrB)invocation_countr/s r"r0zInvocationRecorder.__init__Js
 !r(ch|xjdz
c_||f|_tjdS)NrOs
some bytes)rlast_invocationrrrs   r"rzInvocationRecorder.__call__Ms." $f~zz-((r(Nrr'r(r"rrHs")r(rceZdZ	dZdZdZejeddZ	ejeddZ
ejeddZd	Z
d
ZdZdZd
ZdZdZedZy)Test_hook_compressedc"t|_yr,)r	fake_openr/s r"r;zTest_hook_compressed.setUpVs+-r(c(|jddy)Nr;r!do_test_use_builtin_open_textr/s r"test_empty_stringz&Test_hook_compressed.test_empty_stringYs**2s3r(c(|jddyNabcdr!rr/s r"test_no_extz Test_hook_compressed.test_no_ext\**637r(zRequires gzip and zlibcNtj}|jt_	tjdd}|t_|j|jjd|j|jjdify#|t_wxYw)Ntest.gzr!rO)rr!)gziprrr7hook_compressedrrrrr
original_openrs   r"test_gz_ext_fakez%Test_hook_compressed.test_gz_ext_fake_sy		
NN		&..y#>F%DI88!<77:JB9OP&DIB
B$ctj}dt_	tjddd}|t_|j	t|dgy#|t_wxYw)Nc,tjdS)NsEx-binary string)rrrs  r"rzATest_hook_compressed.test_gz_with_encoding_fake.<locals>.<lambda>ns2::6I+Jr(rr!rrzEx-binary string)rrr7rrrrqrs   r"test_gz_with_encoding_fakez/Test_hook_compressed.test_gz_with_encoding_fakeksU		
J		&..y#PF%DIf(:';<&DIsA
A+zRequires bz2cNtj}|jt_	tjdd}|t_|j|jjd|j|jjdify#|t_wxYw)Ntest.bz2r!rO)rr!)bz2BZ2Filerr7rrrrrrs   r"test_bz2_ext_fakez&Test_hook_compressed.test_bz2_ext_fakeusy
nn	(..z3?F'CK88!<77:KR9PQ(CKrc(|jddy)Nz	abcd.blahrdo_test_use_builtin_open_binaryr/s r"
test_blah_extz"Test_hook_compressed.test_blah_exts,,[$?r(c(|jddy)Nzabcd.Gzrrr/s r"test_gz_ext_builtinz(Test_hook_compressed.test_gz_ext_builtins,,Y=r(c(|jddy)Nzabcd.Bz2rrr/s r"test_bz2_ext_builtinz)Test_hook_compressed.test_bz2_ext_builtins,,Z>r(c(|jddy)Nrrrr/s r"test_binary_mode_encodingz.Test_hook_compressed.test_binary_mode_encodings,,VT:r(c(|jddyrrr/s r"test_text_mode_encodingz,Test_hook_compressed.test_text_mode_encodingrr(c\|j|j}	tj||}|j||j	|jj
d|j	|jj||fdddfy#|j|wxYw)NrOrrreplace_builtin_openrr7rrrrrrr8rrrs     r"rz4Test_hook_compressed.do_test_use_builtin_open_binarys11$..A
	5..x>F%%m488!<77#T*,NO	Q
%%m4BB+c\|j|j}	tj||}|j||j	|jj
d|j	|jj||fdddfy#|j|wxYw)NrOlocalerrrs     r"rz2Test_hook_compressed.do_test_use_builtin_open_texts11$..A
	5..x>F%%m488!<77#T*T,RS	U
%%m4rc<tj}|t_|Sr,)builtinsr)
new_open_funcrs  r"rz)Test_hook_compressed.replace_builtin_opens 


%
r(N)r$r%r&r;rrunittest
skipUnlessrrrrrrrrrrrrstaticmethodrr'r(r"rrSs4.48X78	Q9	QX78=9=Xn-	R.	R@>?;8	Q	Ur(rc eZdZ	dZdZdZy)Test_hook_encodedcft}t}tj||}t}tj
}|t_	t}t}|||}|t_|j
|jd|j\}	}
|j|	d||j|	d||j|
jd||j|
jd||j|
y#|t_wxYw)NrrOrrr)rHr7rrrrrrrrrLpopru)rrrrrrr8ropen_resultrrs           r"testzTest_hook_encoded.tests8''@&(	 


!
	*xH8D 40K)HM33Q7 00f

d1gx(

d1gt$

fjj,h7

fjj*F3 *HMsD##
D0cTttd5}|jddddjttfd}|ddgjt5|ddgddd|ddg|d	d
gy#1swYoxYw#1swY*xYw)Nrsabccttdtd|5}t|}dddj	|y#1swYxYw)Nr!rrr^rr9rr	rrqrr)rexpected_linesrrErs    r"checkz,Test_hook_encoded.test_errors.<locals>.checksMc$0$HJ
!MOR
!
UN3
!
!sAAignoreabcstrictru�abcbackslashreplacez\x80abc)rr	rrrrrrr!rs`  r"test_errorszTest_hook_encoded.test_errorss
&$
	 1
GGJ	 V,	4	h 


1
2	%(UG$	%
i+'
 :,/	 	 	%	%sB*BBB'c0ttd5}|jddddjttfd}|dgdjt5|dgddddy#1swY]xYw#1swYyxYw)Nrs
A
B
C
D+IKw-ctt|td5}t|}dddj	|y#1swYxYw)Nzutf-7rr)rrrrErs    r"rz+Test_hook_encoded.test_modes.<locals>.checksJd$0$9;
!>@R
!
UN3
!
!sAA
r!)rrrD€r)rzB
zC
r)rr	rrrrrrs`  r"
test_modeszTest_hook_encoded.test_modess
&$
	*1
GG()	*	
V,	4	c34


z
*	<$:;	<	<	*	*	<	<sB+BB	BN)r$r%r&rrrr'r(r"rrs1!00"<r(rceZdZdZy)MiscTestc8tj|tyr,)rcheck__all__r7r/s r"test_allzMiscTest.test_allsT9-r(N)r$r%r&rr'r(r"rrs.r(r__main__)3rrryrnr7r%rrrrImportErrorrrrrrpathlibrtest.supportrtest.support.os_helperr	r
rrrrr
rr*TestCaserLrrr r5rErXr_rkrprvr{rrrrrrr$mainr'r(r"<module>rs
	
	!- )8"		"
"
HQy("3"3Qf$$CY 1 1CD
----^0X%6%60*==9==~,9,&2<262<262:262 >262:282!?262;26))W8,,Wr:<)):<z.x  .zHMMO}
CDs"FF%F"!F"%F0/F0