python (3.11.7)

(root)/
lib/
python3.11/
test/
__pycache__/
test_file.cpython-311.opt-1.pyc

e/ddlZddlZddlZddlmZddlmZddlZddlZddl	m
Z
ddlmZddl	m
Z
ddl	mZddlmZGd	d
ZGddeejZGd
deejZGddZGddeejZGddeejZedkrejdSdS)N)array)proxy)
gc_collect)TESTFN)	os_helper)warnings_helper)UserListc\eZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdS)
AutoFileTestscF|td|_dS)Nwb)openrfselfs B/BuggyBox/python/3.11.7/bootstrap/lib/python3.11/test/test_file.pysetUpzAutoFileTests.setUps64((cx|jr|jtjtdSN)rcloserunlinkrrs rtearDownzAutoFileTests.tearDowns26	FLLNNN     rcvt|j}|d||j||jd|_t
|tt|ddS)Ns
teststringtell)
rrwriteassertEqualrrrassertRaisesReferenceErrorgetattr)rps  rtestWeakRefszAutoFileTests.testWeakRefss$&MM	
111.'1f=====rc>|j}|j|j|jdSr)rnamemodeclosedrrs  rtestAttributeszAutoFileTests.testAttributes%s"F			rc`|jd|jtdd}|t
d|_|j|}|d|d|dS)N12b
xxxxxxxxxxrb)	rrrrrrreadintortobytes)rans   rtestReadintozAutoFileTests.testReadinto,sU#w64((FOOA		BQB00000rctdd}|j|td|_t|jdr(|t|jj|dSdS)Nr+r,zutf-8)encodingr.)	rrrrrhasattrr	TypeErrorr.)rr0s  rtestReadinto_textzAutoFileTests.testReadinto_text5sw#w6G4446:&&	=i!<<<<<	=	=rc,tddg}|j||j|t
d|_|j}||ddS)N12r-r*)r	r
writelinesrrrreadr)rlbufs   rtestWritelinesUserListz$AutoFileTests.testWritelinesUserList=sxdD\""!64((fkkmme$$$$$rcV|t|jjgddSN)rr6rr;rs rtestWritelinesIntegersz$AutoFileTests.testWritelinesIntegersFs))TV%6			BBBBBrcttgd}|t|jj|dSrA)r	rr6rr;)rr=s  rtestWritelinesIntegersUserListz,AutoFileTests.testWritelinesIntegersUserListJs6WWW)TV%6:::::rcGdd}|t|jj||gdS)NceZdZdS)8AutoFileTests.testWritelinesNonString.<locals>.NonStringN)__name__
__module____qualname__rr	NonStringrKQsDrrPrE)rrPs  rtestWritelinesNonStringz%AutoFileTests.testWritelinesNonStringOsk									
)TV%6$9;;		4	6	6	6	6	6rc|j}||jt||||jt|dr(|ttf|jd||
|jdS)Nr.)rrr$rassertFalseisattyr&r5rOSErrorr6r.r
assertTruer's  r
testErrorszAutoFileTests.testErrorsWsF((($$$"""1j!!	Dw	2AJCCC				!!!!!rc
ddddddddd	d
ddgffdg
}|d
|jddd||jj|D].\}}t|j|}|jt|g|R/||jdddd	ddzdS#||jjtj
dYdSxYw)N)filenorO)flushrO)rUrO)__next__rOr<rO)r)rreadlinerO	readlinesrO)seek)r)rrOr;)__iter__rO)truncaterOrBr)appendr__exit__rWr&r r
ValueErrorrsysexc_info)rmethods
methodnameargsmethods     rtestMethodszAutoFileTests.testMethodsbs8! !#$#$!$ 2%(#
	'(((	
dD)))
&&& '	9	9JTVZ00FDj&8488888	
tT::DAAA	E
aCCCC	E_TV_clnn=tDDDDDDsC6DcP|t|jjdSr)rrVrr<rs rtestReadWhenWritingz!AutoFileTests.testReadWhenWritings"'46;/////rN)rLrMrNrrr"r(r2r7r?rFrHrQrXrnrprOrrrrs)))!!!
>>>111===%%%CCC;;;
666	"	"	" E E ED00000rrceZdZejZdS)CAutoFileTestsNrLrMrNiorrOrrrrrr
7DDDrrrc.eZdZeejZdS)PyAutoFileTestsNrLrMrNstaticmethodpyiorrOrrrwrw<	""DDDrrwc>eZdZdZdZdZdZdZdZdZ	dZ
d	S)
OtherFileTestsc8tjtdSr)rrrrs rrzOtherFileTests.tearDowns     rc|tddD]Z}	|t|}||d|zK#t$rYWwxYwdS)Nr
)rSaUzwU+zU+z+UzrU+z%r is an invalid file mode)rrrfailrg)rr%rs   rtestModeStringszOtherFileTests.testModeStringss		&$%%'''8	?	?D
?IIfd++					6=>>>>	



	?	?sA;;
BBctjdkr|dtjs|d|ttf5tjddddn#1swxYwY|ttf5tj	ddddS#1swxYwYdS)Nosf1V5zE sys.stdin.seek(-1) may crash the interpreter on OSF1. Test manually.z stdin must be a TTY in this test)
rhplatformskipTeststdinrUrIOErrorrgrbrdrs r	testStdinzOtherFileTests.testStdinsh<8##MM"
#
#
#y!!	>MM<===


4
5
5		INN2															


4
5
5	!	!I   	!	!	!	!	!	!	!	!	!	!	!	!	!	!	!	!	!	!s$: B&&B*-B*C>>DDcld}	|t|}||d|zdS#t$r\}|jddkr:t
|}t|vs||vr$|d|zYd}~dSYd}~dSYd}~dSd}~wwxYw)Nqwertyzno error for invalid mode: %srz&bad error message for invalid mode: %s)rrrrrgrlstr)rbad_modermsgss     rtestBadModeArgumentz"OtherFileTests.testBadModeArguments	B		&(++A
GGIIIII5@AAAAA	L	L	Lx{aHHQ;;(!"3"3IIFJKKKKKKKKK "3"3"3"3"3"3	LsA

B3AB..B3c	|td|}|t|d|||td|}t
|d}||n>#t$r1}|
d|t|fzYd}~nd}~wwxYw|||dS)Nr
asciir-z error setting buffer size %d: %s)rrrrencoderintr<decoderVrr)rrrdrs     r_checkBufferSizezOtherFileTests._checkBufferSizes
	J		&$**A
GGCFFMM'**+++
GGIII
GGIII		&$**AAFFHHOOG,,--A
GGIII
GGIIII	J	J	JII8As3xx=HIIIIIIII	JAsC1C44
D/>'D**D/c4dD]K}tj|dt5||dddn#1swxYwYL|td5|dddddS#1swxYwYdS)N)rrizline buffering)messagecategoryrB)rcheck_no_warningsRuntimeWarningrassertWarnsRegex)rrs  rtestSetBufferSizez OtherFileTests.testSetBufferSizes3	)	)A 243C4BDDD
)
)%%a(((
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
"
">3C
D
D	%	%!!!$$$	%	%	%	%	%	%	%	%	%	%	%	%	%	%	%	%	%	%s#AA	
A	*B

BBcb|td}	|d||td}|d}|dkr|d|z|dkr*|d|z||dkr*|d|z|tj	
t}|dkr|d	|z|dS#|wxYw)
Nr
s12345678901zrb+s12345z(Read on file opened for update failed %rzFile pos after read wrong %dz!File pos after ftruncate wrong %dz"File size after ftruncate wrong %d)rrrrr<rrrdospathgetsize)rrdatasizes    rtestTruncateOnWindowsz$OtherFileTests.testTruncateOnWindowssS
IIfd##	
GGN###
GGIII		&''A66!99Dx		DtKLLLvvxx1}}		816688CDDD
JJLLLvvxx1}}		=HIII
GGIII7??6**Dqyy		>EFFF
GGIIIIIAGGIIIIsE%FF.cd}d}|t|z}gd}ddddtdd	ffg}|td
}|||z||||D]l\}}|td}	|t|	|t|	|}
|
||	m|td}	t|D]}t|	|d}	|	}
n%#t$r|d
YnwxYw|
|kr|d|
d||d}tddt|z}	|	|n%#t$r|dYnwxYw|}
|
|kr|d|
d||d}	|	t|}
n%#t$r|dYnwxYw|
|kr|d|
d|	|	}n%#t$r|dYnwxYw||kr|d|
d||	|td}		|	D]}
	|	|	||	|	n%#t$r|dYnwxYw|	dS#|	wxYw)Ni@sham
)sspam, spam and eggs
seggs, spam, ham and spam
ssaussages, spam, spam and eggs
sspam, ham, spam and eggs
s(spam, spam, spam, spam, spam, ham, spam
swonderful spaaaaaam.
r^r]r`r.r+sd                                                                                                    r
r-rzLreadline() after next() with supposedly empty iteration-buffer failed anywayz6readline() after next() with empty buffer failed. Got z, expected zLreadinto() after next() with supposedly empty iteration-buffer failed anywayz6readinto() after next() with empty buffer failed. Got zHread() after next() with supposedly empty iteration-buffer failed anywayz2read() after next() with empty buffer failed. Got zMreadlines() after next() with supposedly empty iteration-buffer failed anywayz7readlines() after next() with empty buffer failed. Got z'read* failed after next() consumed file)lenrrrrr;rrnextr rangepopr_rgrr.r/r<ra)r
dataoffsetfillernchunks	testlinesrjbagrkrlrmethitestlineliner>liness                r
testIterationzOtherFileTests.testIterations
F+


	$\3DsH!5!5 78:ii%%		&7"###y!!!		 '		J		&$''AT!WWf---1j))DD$KK
GGIIII
IIfd##w		AGGGG==##	:::<<DD	:	:	:II9
:
:
:
:
:	:8III9=xxI
J
J
J==##C3x==011	:
JJsOOOO	:	:	:II9
:
:
:
:
:	:{{}}8III9=xxI
J
J
J==##	:66#h--((DD	:	:	:II9
:
:
:
:
:	:8III9=xxI
J
J
J	:KKMMEE	:	:	:II9
:
:
:
:
:	:IIII9=xxI
J
J
J				
IIfd##	


E



3




E
E
E		CDDDDD
E
GGIIIIIAGGIIIIsyE$$FF G66HH&"J		J+*J+K%%LLO.!AN32O.3OO.OO..PN)rLrMrNrrrrrrrrrOrrr}r}s!!!
?
?
?!!! BBB %%%8_____rr}ceZdZejZdS)COtherFileTestsNrsrOrrrrXrurrc.eZdZeejZdS)PyOtherFileTestsNrxrOrrrr[r{rr__main__)rhrunittestrweakrefrrt_pyiorztest.supportrtest.support.os_helperrrrcollectionsr	rTestCaserrrwr}rrrLmainrOrr<module>rs



								######))))))""""""((((((      u0u0u0u0u0u0u0u0n]H$5#####mX%6###HHHHHHHHTnh&7#####~x'8###zHMOOOOOr