Current File : //opt/imh-python/lib/python2.7/test/test_file2k.pyo
�
��Wc@s�ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	m	Z	ddl
mZyddlZWne
k
r�eZnXddlmZddlmZmZmZddlmZdejfd��YZd	ejfd
��YZdejfd��YZejed
�dejfd��Y�Zejejdkd�dejfd��Y�Zdejfd��YZd�Ze dkr�e�ndS(i����N(tarray(tproxy(ttest_support(tTESTFNtrun_unittesttrequires(tUserListt
AutoFileTestscBs�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�ZRS(cCsttd�|_dS(Ntwb(topenRtf(tself((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pytsetUpscCs*|jr|jj�ntjt�dS(N(R
tclosetostremoveR(R((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyttearDowns	cCskt|j�}|jd�|j|jj�|j��|jj�d|_|jtt	|d�dS(Nt
teststringttell(
RR
twritetassertEqualRR
tNonetassertRaisestReferenceErrortgetattr(Rtp((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyttestWeakRefs s

	c	Cs�|j}tj��|j}WdQX|j|j|jtj��||_WdQXx-dD]%}|jtt	ft
||d�q]WdS(Ntnametmodetclosedtoops(snamesmodesclosed(R
Rtcheck_py3k_warningst	softspaceRRRRtAttributeErrort	TypeErrortsetattr(RR
R tattr((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyttestAttributes)s	


cCsn|jjd�|jj�tdd�}ttd�|_|jj|�}|jd|j�| �dS(Nt12tctxi
trbt
xxxxxxxxxx(	R
RR
RR	RtreadintoRttostring(Rtatn((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyttestReadinto:s
cCsdtddg�}|jj|�|jj�ttd�|_|jj�}|j|d�dS(Nt1t2R)R&(RR
t
writelinesR
R	RtreadR(Rtltbuf((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyttestWritelinesUserListCs
cCs&|jt|jjdddg�dS(Niii(RR"R
R2(R((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyttestWritelinesIntegersLscCs2tdddg�}|jt|jj|�dS(Niii(RRR"R
R2(RR4((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyttestWritelinesIntegersUserListPscCs<ddd��Y}|jt|jj|�|�g�dS(Nt	NonStringcBseZRS((t__name__t
__module__(((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyR9Ws((RR"R
R2(RR9((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyttestWritelinesNonStringUscCs^|jjtdd�g�|jj�ttd�|_|jj�}|j|d�dS(NR'tabcR)(R
R2RR
R	RR3R(RR5((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyttestWritelinesBuffer]s

cCs�|jt|j�jdt��tjdkr8dnd}t|d��:}|jt	j
|�|jt|�jd|��WdQXdS(Ns<open file 'twin32sxx
xx
xx'xx"xxsxx'xxtws<open file %r, mode 'w' at(t
assertTruetreprR
t
startswithRtsystplatformR	t
addCleanupRR(RtfnameR
((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyttestReprds#cCs�|jj�ttd�|_|j}|j|jt�|j|j��|j|j�|j	t
|jd�|j�|j|j�dS(NR)t(R
R
R	RRRRAtisattyRRR"R+(RR
((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyt
testErrorsos
	
c
Csqddddddddd	d
ddd
g
}dg}tjjd�rX|jd�n|jjddd�|j|jj�x0|D](}t	|j|�}|j
t|�q�Wtj
��8x0|D](}t	|j|�}|j
t|�q�WWdQX|j
t|jjg�|j|jjddd�d�yddWn)|j|jjtj��d�nXdS(NtfilenotflushRJtnextR3R+treadlinet	readlinestseekRttruncateRt__iter__t
xreadlinestatheosii(RDRERCRR
t__exit__RRARRRt
ValueErrorRRR2Rtexc_info(Rtmethodstdeprecated_methodst
methodnametmethod((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyttestMethods{s*	


"cCs|jt|jj�dS(N(RtIOErrorR
R3(R((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyttestReadWhenWriting�scs/�fd�}�jt�jj|��dS(Nc3sBx;td�D]-}|dkr/�jj�nt|�Vq
WdS(Nii(trangeR
R
tstr(ti(R(si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pytnasty�s(RRWR
R2(RRc((Rsi/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyttestNastyWritelinesGenerator�scs�d}xddddgD]}xbdddgD]Q}tt|��_�jj|��jtt�j|���jj�q/Wtt|��_�jj|��jt�fd	���jj�tt|��_�jj|��jt�jjt	t
|����jj�qWx�d
ddd
ddddgD]�}tt|��_�jt�jj|��jj�tt|��_�jt�jj||g��jj�tt|��_�jt�jj��jj�qCWdS(NtxxxR@RR-tabR3RORPcsg�jD]}|^q
S(N(R
(tline(R(si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyt<lambda>�strR)tUtUbtUrtrUtrbUtrUb(
R	RR
RRR^RR
R+t	bytearraytlenR2RR(RtdataRR$((Rsi/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyt
testIssue5677�s2
%%

(R:R;RRRR%R/R6R7R8R<R>RHRKR]R_RdRs(((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyRs 																		tOtherFileTestscBs�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
eje
jd	kd
�d��Zejejdkd�ejddde�d���ZRS(cCs�tjjt�ptj}xldD]d}y(|rCt||�}nt|�}Wn&tk
rx}|j|j	|�q"X|j
d�q"WdS(NR@s+opening a directory didn't raise an IOError(NR@(Rtpathtdirnamet__file__tcurdirRR	R^Rtfilenametfail(Rtthis_dirRR
te((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyttestOpenDir�s
cCs�xPdD]H}ytt|�}Wntk
r3qX|j�|jd|�qWx^ttt�ttd�fD]=}yt|d�}Wnttfk
r�qsX|j�qsWdS(NRItaUswU+s%r is an invalid file modes	trr(RIR~swU+(R	RRWR
RztunicodeR^(RRR
R((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyttestModeStrings�s


&cCs[tjdkr|jd�ntjj�s>|jd�n|jttjjd�dS(Ntosf1V5sISkipping sys.stdin.seek(-1), it may crash the interpreter. Test manually.s stdin must be a TTY in this testi����(RDREtskipTesttstdinRJRR^RQ(R((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyt
testStdinSeek�s
cCs|jttjj�dS(N(RR^RDR�RR(R((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyttestStdinTruncate�scCsPttt�d�}|jt|�jdt��|j�tjt�dS(NR@s
<open file u'(	R	R�RRARBRCR
Rtunlink(RR
((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyttestUnicodeOpen�s 
cCs�d}ytt|�}Wnatk
r|}|jddkr�t|�}t|ksb||kry|jd|�qyq�nX|j�|jd|�dS(Ntqwertyis&bad error message for invalid mode: %ssno error for invalid mode: %s(R	RRWtargsRaRzR
(Rtbad_modeR
tmsgts((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyttestBadModeArguments
cCs�x�dD]�}yuttd|�}|jt|��|j�|j�ttd|�}t|j��}|j�|j�Wn0tk
r�}|jd|t|�f�nX|j	||�qWdS(	Ni����iiiR@Ris error setting buffer size %d: %s(i����iii(
R	RRRaR
tintR3R^RzR(RR�R
tdR�((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyttestSetBufferSizes



!cs<tjt��fd�}z|�Wdtjt�XdS(Ncsttd�}|jd�|j�ttd�}|jd�}|dkrd�jd|�n|j�dkr��jd|j��n|j�|j�dkr��jd|j��n|j�tj	j
t�}|dkr�jd	|�ndS(
NRt12345678901srb+it12345s(Read on file opened for update failed %rsFile pos after read wrong %ds!File pos after ftruncate wrong %ds"File size after ftruncate wrong %d(R	RRR
R3RzRRRRRutgetsize(R
Rrtsize(R(si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyt	bug801631%s 



(RR�R(RR�((Rsi/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyttestTruncateOnWindows"s

cCs�d}d}|t|�}ddddddg}d	dfd
dfdd fdtd
dd�ffg}z6ttd�}|j||�|j|�|j�x�|D]�\}}tt�}	|	j�|kr�|jdfnt	|	|�}
y|
|�Wnt
k
rnX|jd||f�|	j�q�Wtt�}	xt|�D]}|	j�qXW|jd�}y|	j
�}
Wnt
k
r�|jd�nX|
|kr�|jd|
|f�n|jd�}td
dt|��}y|	j|�Wnt
k
r+|jd�nX|j�}
|
|kr^|jd|
|f�n|jd�}y|	jt|��}
Wnt
k
r�|jd�nX|
|kr�|jd|
|f�ny|	j�}Wnt
k
r�|jd�nX||kr$|jd|
|f�ntt�}	zex|	D]}
q:Wy/|	j
�|	j|�|	j�|	j�Wnt
k
r�|jd�nXWd|	j�XWdtjt�XdS(!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.
ROR3RPR+R't idR@sBroken testfiles)%s%r after next() didn't raise ValueErrorisLreadline() after next() with supposedly empty iteration-buffer failed anywaysEreadline() after next() with empty buffer failed. Got %r, expected %rtsLreadinto() after next() with supposedly empty iteration-buffer failed anywaysEreadinto() after next() with empty buffer failed. Got %r, expected %rsHread() after next() with supposedly empty iteration-buffer failed anywaysAread() after next() with empty buffer failed. Got %r, expected %rsMreadlines() after next() with supposedly empty iteration-buffer failed anywaysFreadlines() after next() with empty buffer failed. Got %r, expected %rs'read* failed after next() consumed file((((RqRR	RRR2R
RNRzRRWR`tpopROR+R,R3RPRR�(Rt
dataoffsettfillertnchunkst	testlinesRYtbagR[R�R
tmethRbttestlineRgR5tlines((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyt
testIterationAs�		


		
	
	
	
	




tposixstest requires a posix system.cCsd}tjj|�o0tjtj|�j�sG|jd|�nt|dd��*}|jt	��|j
d�WdQXWdQXt|dd��7}|jt	��|j
d�|j
d�WdQXWdQXt|dd��*}|jt	��|j
d	�WdQXWdQXdS(
Ns	/dev/fullsrequires %rRishello
thellos
ith(RRutexistststattS_ISCHRtst_modeR�R	RR^R(RtdevfullR
((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyttest_write_full�s
iisrequires 64-bit systemg@tdry_runcCs�td�ttd��%}|j|d�|jd�WdQXttd��}x|D]}qYWWdQX|jt|�|�|j|jd�|�d}dS(Nt	largefileRiR�R)(	RR	RRQRRRqtcountR(RR�tfpR4((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyttest_very_long_line�s


I�I�(R:R;R}R�R�R�R�R�R�R�R�tunittestt
skipUnlessRRR�RDtmaxsizeRtprecisionbigmemtesttFalseR�(((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyRt�s	
		
						o$tFileSubclassTestscBseZd�ZRS(cCsBdtfd��Y}|td��}WdQX|j|j�dS(NtCcBseZd�Zd�ZRS(cWst|_tj||�dS(N(R�tsubclass_closedtfilet__init__(RR�((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyR��s	cSst|_tj|�dS(N(tTrueR�R�R
(R((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyR
�s	(R:R;R�R
(((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyR��s	R@(R�RRAR�(RR�R
((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyttestExit�s(R:R;R�(((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyR��ss!Threading required for this test.tFileThreadingTestscBs�eZd�Zd�Zd�Zd�Zd�Zdd�Zdd�Zd	�Z	d
�Z
d�Zd�Zd
�Z
d�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(cCs�tj�|_d|_t|_t|jd��}|jdj	d��WdQXt
j�|_d|_
d|_t|_dS(NR@s
t
0123456789i(Rtthreading_setupt_threadsRR
RRyR	Rtjoint	threadingtLockt_count_locktclose_counttclose_success_countR�t
use_buffering(RR
((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyR�s				cCss|jr7y|jj�Wq7ttfk
r3q7Xnytj|j�Wntk
r^nXtj|j	�dS(N(
R
R
tEnvironmentErrorRWRRRyRtthreading_cleanupR�(R((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyR�s	
cCs@|jr't|jddd�|_nt|jd�|_dS(Nsw+t	bufferingiii@(R�R	RyR
(R((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyt_create_files	cCsO|j�|jd7_WdQX|jj�|j�|jd7_WdQXdS(Ni(R�R�R
R
R�(R((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyt_close_files



cCs|j�|j�dS(N(R�R�(R((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyt_close_and_reopen_file
s
g�������?c	Cs|j�d|_d|_WdQXt|_g}z�x=t|�D]/}tjd|�}|j�|j	|�qAWxct
d�D]U}tj|d�|j�3|j|j|dkr�t
jr�dGnPnWdQXq�Wtj|�Wdt|_x|D]}|j�q�WXdS(NittargetiditQ(R�R�R�R�tdo_continueR`R�tThreadtstarttappendtxrangettimetsleepRtverboseR�R�(Rtfunct
nb_workerstdurationtthreadsRbttt_((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyt_run_workerss*
		

		
icsY��fd�}�j||�tjrUdd�j�j}�jGd|GndS(Ncsx�j�tj�fd��fd�f�}x@|D]8}�jsKPny|�Wq8ttfk
roq8Xq8WdS(Ncs��S(N(((tio_func(si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyRh/scs
�j�S(N(R�((R(si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyRh0s(R�t	itertoolstcycleR�R^RW(tfuncsR
(R�R(si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pytworker,s

	gY@s%.4f (R�RR�R�R�(RR�R�R�tpercent((R�Rsi/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyt_test_close_open_io+s

	cCsd�}|j|�dS(NcSsdS(N((((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyR�Cs(R�(RR�((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyttest_close_openBs	cs �fd�}�j|�dS(Ncs�jj�dS(N(R
RM((R(si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyR�Hs(R�(RR�((Rsi/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyttest_close_open_flushGscs �fd�}�j|�dS(Ncstt�j��dS(N(tlisttiterR
((R(si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyR�Ms(R�(RR�((Rsi/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyttest_close_open_iterLscs �fd�}�j|�dS(Ncs�jj�dS(N(R
RJ((R(si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyR�Rs(R�(RR�((Rsi/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyttest_close_open_isattyQscs �fd�}�j|�dS(Ncs�jdIJdS(NRI(R
((R(si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyR�Ws(R�(RR�((Rsi/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyttest_close_open_printVscs)t�_�fd�}�j|�dS(Ncs�jdIJdS(NRI(R
((R(si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyR�]s(R�R�R�(RR�((Rsi/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyttest_close_open_print_buffered[s	cs �fd�}�j|�dS(Ncs�jjd�dS(Ni(R
R3((R(si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyR�bs(R�(RR�((Rsi/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyttest_close_open_readascs �fd�}�j|�dS(Ncs#tdd�}�jj|�dS(NR'txxxxx(RR
R+(R-(R(si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyR�gs(R�(RR�((Rsi/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyttest_close_open_readintofscs �fd�}�j|�dS(Ncs�jj�dS(N(R
RO((R(si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyR�ms(R�(RR�((Rsi/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyttest_close_open_readlinelscs �fd�}�j|�dS(Ncs�jj�dS(N(R
RP((R(si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyR�rs(R�(RR�((Rsi/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyttest_close_open_readlinesqscs �fd�}�j|�dS(Ncs�jjdd�dS(Ni(R
RQ((R(si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyR�ws(R�(RR�((Rsi/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyttest_close_open_seekvscs �fd�}�j|�dS(Ncs�jj�dS(N(R
R((R(si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyR�|s(R�(RR�((Rsi/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyttest_close_open_tell{scs �fd�}�j|�dS(Ncs�jj�dS(N(R
RR((R(si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyR��s(R�(RR�((Rsi/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyttest_close_open_truncate�scs �fd�}�j|�dS(Ncs�jjd�dS(NRI(R
R((R(si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyR��s(R�(RR�((Rsi/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyttest_close_open_write�scs �fd�}�j|�dS(Ncs�jjd�dS(NRI(R
R2((R(si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyR��s(R�(RR�((Rsi/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyttest_close_open_writelines�s(R:R;RRR�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�(((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyR��s,																			R�stest requires a posix system.tTestFileSignalEINTRcBsPeZed�Zed�Zd�Zed�Zd�Zd�Zd�Z	RS(cCs�|r!|jdd�}d}nd}d|dd|}tjtjd|gd	tjd
tjdtj�}|jjd�}|d
kr�|j�|j	d|||jj�f�n|j
j|�d}	g}
x�|
sbtj|jgddd�\}
}}|j
tj�tjd�|	d7}	|	dkr�|j�|j	d|�q�q�W|jj�}|dkr�|j�|j	d|||jj�f�n|jdd�\}
}|jdkr�|j	d||j|
|f�ndS(skGeneric buffered read method test harness to verify EINTR behavior.

        Also validates that Python signal handlers are run during the read.

        Args:
            data_to_write: String to write to the child process for reading
                before sending it a signal, confirming the signal was handled,
                writing a final newline char and closing the infile pipe.
            read_and_verify_code: Single "line" of code to read from a file
                object named 'infile' and validate the result.  This will be
                executed as part of a python subprocess fed data_to_write.
            method_name: The name of the read method being tested, for use in
                an error message on failure.
            universal_newlines: If True, infile will be opened in universal
                newline mode in the child process.
        s
s
s,infile = os.fdopen(sys.stdin.fileno(), "rU")sinfile = sys.stdins\import os, signal, sys ;signal.signal(signal.SIGINT, lambda s, f: sys.stderr.write("$\n")) ;s ;s<assert isinstance(infile, file) ;sys.stderr.write("Go.\n") ;s-cR�tstdouttstderrisGo.
s-Error from %s process while awaiting "Go":
%sig�������?g�������?ii�s"failed to handle signal during %s.s$
s/Error from %s process while awaiting signal:
%stinputs0%s() process exited rc=%d.
STDOUT:
%s
STDERR:
%sN(((treplacet
subprocesstPopenRDt
executabletPIPER�R3tkillRzR�Rtselecttsend_signaltsignaltSIGINTR�R�ROtcommunicatet
returncode(Rt
data_to_writetread_and_verify_codetmethod_nametuniversal_newlinestinfile_setup_codet
child_codetreader_processtgotsignals_senttrlistR�tsignal_lineR�R�((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyt
_test_reading�sD	
		'



		c	Cs&|jddddddd|�dS(	s4file.readline must handle signals and not lose data.R	s
hello, world!R
s�line = infile.readline() ;expected_line = "hello, world!\n" ;assert line == expected_line, ("read %r expected %r" % (line, expected_line))RRORN(R(RR((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyt
test_readline�s
	cCs|jdt�dS(NR(RR�(R((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyt%test_readline_with_universal_newlines�sc	Cs&|jddddddd|�dS(	s5file.readlines must handle signals and not lose data.R	shello
world!R
s�lines = infile.readlines() ;expected_lines = ["hello\n", "world!\n"] ;assert lines == expected_lines, ("readlines returned wrong data.\n" "got lines %r\nexpected  %r" % (lines, expected_lines))RRPRN(R(RR((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyttest_readlines�s
	cCs|jdt�dS(NR(RR�(R((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyt&test_readlines_with_universal_newlinesscCs |jdddddd�dS(s<Unbounded file.read() must handle signals and not lose data.R	shello, world!abcdefghijklmR
s�data = infile.read() ;expected_data = "hello, world!abcdefghijklm\n";assert data == expected_data, ("read %r expected %r" % (data, expected_data))Rsunbounded readN(R(R((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyttest_readalls	cCs |jdddddd�dS(s4file.readinto must handle signals and not lose data.R	s
hello, world!R
s�data = bytearray(50) ;num_read = infile.readinto(data) ;expected_data = "hello, world!\n";assert data[:num_read] == expected_data, ("read %r expected %r" % (data, expected_data))RR+N(R(R((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyt
test_readintos	(
R:R;R�RRRRRRR(((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyR��sO
			tStdoutTestscBs#eZd�Zd�Zd�ZRS(csHtj�dd�fd��Y}z|�t_dGHWd�t_XdS(NtFilecseZ�fd�ZRS(csd|kr�t_ndS(Ns
(RDR�(RRr(tsave_stdout(si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyR&s(R:R;R((R(si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyR%ss	some text((RDR�(RR((Rsi/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyttest_move_stdout_on_write s		cCsbtj}t`zByHWn)tk
rB}|jt|�d�nX|jd�Wd|t_XdS(Nslost sys.stdoutsExpected RuntimeError(RDR�tRuntimeErrorRRaRz(RRR|((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyttest_del_stdout_before_print0s	cs�ddl���fd����fd�}|ddd�|ddd�|dd	d
�|ddd�|dd
d�|ddd�x7dD]/}�ddd|d�}�j|d�q�WdS(Ni����cs{dj|�}tjj�}||d<�jtjd|gd�jd|�}|j�\}}�j	|j
d�|S(Ns
tPYTHONIOENCODINGs-cR�tenvi(R�RtenvirontcopyR�RDRRRRR(tencodingtcodeR"tprocessR�R�(RR�(si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pytget_messageAs
cs-�|dd|d�}�j||�dS(Ns
import sysssys.stdout.write(%r)ssys.stdout.flush()(R(ttextR%texpectedR�(R(R(si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyt
check_messageKs
	u15€siso-8859-15s15�sutf-8s15€s	utf-16-let15� siso-8859-1:ignoret15siso-8859-1:replaces15?siso-8859-1:backslashreplaces15\u20actbufferRptasciis
import sysssys.stdout.write(%s("\xe9"))ssys.stdout.flush()s�(sbuffers	bytearray(R�R(RR+tobjtypeR�((R(RR�si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyttest_unicode>s

	(R:R;RR R1(((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyRs		cCsGzttttttt�Wdtjj	t
�rBtjt
�nXdS(N(RRRtR�R�R�RRRuR�RR�(((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyt	test_maines
t__main__(!RDRR�R�RRR�R�R�RtweakrefRR�tImportErrorRttestRttest.test_supportRRRRtTestCaseRRtR�R�R�RR�RR2R:(((si/builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/test/test_file2k.pyt<module>s:

��
��G