"[v7fSrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSK r SSK r SSK r SSKJ r Jr SSKJrJr SSKJr SSKJrJr SSKJr SSKJr SS KJr SS K Jr "S S 5r"S S5r"SS\\ R<5r"SS5r "SS\\ R<5r!"SS5r""SS\ R<5r#"SS\#5r$"SS\#5r%"SS\#5r&"SS \#5r'"S!S"\#5r("S#S$\#5r)"S%S&\#5r*"S'S(\#5r+"S)S*\#5r,"S+S,5r-"S-S.\ R<5r."S/S0\ R<5r/"S1S2\ R<5r0\1S3:Xa\ Rd"5 gg!\ a Sr GNtf=f!\ a Sr GN~f=f)4z, Tests for fileinput module. Nick Mathewson N)BytesIOStringIO) FileInput hook_encoded)verbose)TESTFNFakePath)unlink) os_helper)support)mockc"\rSrSrSS.SjrSrg) BaseTests'wmodec[R"5up4UR[RU5 SU;aSOSn[ X2US9nUR U5 SSS5 U$!,(df  U$=f)Nbutf-8encoding)tempfilemkstemp addCleanupr r openwrite)selfcontentrfdnamerfs :/opt/alt/python313/lib64/python3.13/test/test_fileinput.pywriteTmpBaseTests.writeTmp*sc##%  (($/$;4G "X .! GGG / / . s A(( A7N)__name__ __module__ __qualname____firstlineno__r$__static_attributes__r&r#rr's),r,rcJ\rSrSrSr\S5rSrS SjrS Sjr Sr S r g) LineReader2c/UlgN _linesreadrs r#__init__LineReader.__init__4s r,cHURSS/Ul$!/Ulf=fr1r2r4s r# linesreadLineReader.linesread7s" !??1% DObDOs !cD[URS55UlU$NT)iter splitlinesit)rfilenamers r#openhookLineReader.openhook>sx**401 r,Nch[URS5nURRU5 U$)N)nextr>r3append)rsizelines r#readlineLineReader.readlineBs)DGGR  t$ r,c/nSnUR5nU(dU$URU5 U[U5- nX1:aU$MANr)rHrElen)rhintlinesrFrGs r# readlinesLineReader.readlinesGsK==?D LL  CI D| r,cgr1r&r4s r#closeLineReader.closeSs r,)r3r>r1)) r'r(r)r*r5propertyr8r@rHrOrRr+r&r,r#r.r.2s/!!   r,r.c\rSrSrSrSrg)BufferSizesTestsVc8 URSRS[S5555nURSRS[S5555nURSRS[S5555nURSRS[S 5555n[R"S 5n[ (a [ S 5 [XX44S S 9n[U5nUR5 UR[U5S5 URUSS5 URUSS5 URUR5S5 URUR5U5 [ (a [ S5 [XX44S S 9nSnU(a%US:waUR5nU(aUS:waMURUR5U5 URUR5S5 URUR5S5 UR!UR#55 UR!UR%55 [ (a [ S5 UR'5 URUR5S5 URUR5S5 UR5 [ (a [ S5 [XX4S4S S 9n[(R*n [-S5[(l[U5nUR[U5S5 URUSS 5 URUR5S!5 UR'5 U [(l[ (a [ S"5 [XX44S S 9nURUR5S#5 URUR5S5 UR'5 URUR5S#5 URUR5S5 [ (a [ S$5 [(R.n [XX44S%S S&9nUH!n U SS'R15n [ U 5 M# UR5 U [(l[XX44S S 9nUHvn URU S'S(5 UR3U SS'5n UR5U S5 UR[7U R9S 55UR55 Mx UR5 g!U [(lf=f!U [(lf=f))NrCc32# UH nSUS--v M g7f)zLine %s of file 1 Nr&.0is r# 5BufferSizesTests.test_buffer_sizes..Y"T)Q#8AaC#@)c32# UH nSUS--v M g7f)zLine %s of file 2 r[Nr&r\s r#r_r`Zrarb c32# UH nSUS--v M g7f)zLine %s of file 3 r[Nr&r\s r#r_r`["S(Q#8AaC#@(rbc32# UH nSUS--v M g7f)zLine %s of file 4 r[Nr&r\s r#r_r`\rgrbr[zLINE (\d+) OF FILE (\d+)z1. Simple iterationrfilesrzLine 5 of file 1 zLine 1 of file 4 z2. Status variablesxzLine 6 of file 2 z 3. NextfilezLine 1 of file 3 z4. Stdin-z Line 1 of stdin Line 2 of stdin ! zLine 2 of stdin zz5. Boundary conditionsrz 6. InplaceTrkinplacerrT )r$joinrangerecompilerprintrlistrR assertEqualrLlinenor?rH filelineno assertFalse isfirstlineisstdinnextfilesysstdinrstdoutuppermatchassertNotEqualintgroup) rt1t2t3t4patfirNs savestdin savestdoutrGms r#test_buffer_sizes"BufferSizesTests.test_buffer_sizesWs= ]]277"T%PR)"TT U ]]277"T%PR)"TT U ]]277"S%PQ("SS T ]]277"S%PQ("SS Tjj45 7 ' ( bb- @R   UR( q#78 r$89 b) + 7 ' ( bb- @ A-- AA-- + b) !, )* & 7 -   (<= b)  7 *  bbc2W EII  " !EFCIHE   SZ ,   U2Y(; <   R[[]I 6 KKM!CI 7 * + bb- @ a( -  a( - 7 , ZZ  $""!14'RBCRy(d  HHJ#CJ bb- @D   T"Xt , $s)$A   4 (   S_bmmo >   ;"CI*$CJs1A?U<AV < V  Vr&N)r'r(r)r*rr+r&r,r#rWrWVsPr,rWc \rSrSrSrSrSrg)UnconditionallyRaisecXlSUlgNFexception_typeinvoked)rrs r#r5UnconditionallyRaise.__init__s, r,c0SUlUR5er;)rrrargskwargss r#__call__UnconditionallyRaise.__call__s !!##r,rNr'r(r)r*r5rr+r&r,r#rrs $r,rc\rSrSrSrSrSrSrSrSr Sr S r S r S r S rS rSrSrSrSrSrSrSrSrSrSrSrSrg)FileInputTestscURS5nURS5nURS5nURS5n[XX44SS9nUR5nURUS5 URUR 5S5 URUR 5S5 URUR 5U5 UR5nURU5 URUR 5S5 URUR 5S5 URUR 5U5 UR5 g)NrCzThe only line there is. rrjr[r) r$rrHrrrr?rrR)rrrrrrrGs r#test_zero_byte_files#FileInputTests.test_zero_byte_filess ]]2  ]]2  ]]6 7 ]]2  bb- @{{} :; a( !, +{{}  a( !, +  r,cURS5nURS5n[X4SS9n[U5nURU/SQ5 URUR 5S5 URUR 5S5 g)NA B CD E FrrjA B CzD zE Frq)r$rr~rrrrrrrrNs r#%test_files_that_dont_end_with_newline4FileInputTests.test_files_that_dont_end_with_newlinesr ]]9 % ]]9 % bX 8R  FG !, a(r,cURS5nURS5n[X4SS9nURUR5S5 [ U5nUR UR5S5 UR 5 URUR5S5 [U5nURUR5S5 g)NzA BzC DrrjrT)r$rrfilenorDrrr~)rrrrrGs r# test_filenoFileInputTests.test_filenos ]]6 " ]]6 " bX 8 b)Bx BIIK,  b)Bx b)r,cSHBnURUS9 UR[5 [US9 SSS5 SSS5 MD g!,(df  N=f!,(df  Mg=f)N)rrUUr)subTest assertRaises ValueErrorr)rrs r#test_invalid_opening_mode(FileInputTests.test_invalid_opening_modesM$D4(&&z24(3)(%22)(s!A A A A A A* c[R"S5n[S5Ul[ S/SS9n[ U5nUR US/5 SSS5 g!,(df  g=f)Nz sys.stdinspam, bacon, sausage, and spamrsrbrkr)r patchrbufferrr~r)rm_stdinrrNs r#test_stdin_binary_mode%FileInputTests.test_stdin_binary_modesT ZZ $$%FGGN#T2BHE   U%F$G H % $ $s :A A(c([Rn[S5[lUR[ [RS55 [ S/SS9n[ U5nURUS/5 U[lg!U[lf=f)Nrrrsrr)rrrrhasattrrr~r)r orig_stdinrrNs r#test_detached_stdin_binary_mode.FileInputTests.test_detached_stdin_binary_modespYY  # ABCI   WSYY9 :#T2BHE   U%F$G H"CI CIs A&B Bc[SSS9nURS5 [SS9nURS5 "SS 5nURS 5nU"5n[U/US9nUR 5 SSS5 UR UR S 5 g![a Nf=f![a Nf=f!,(df  NK=f) NTcgr1r&)r"rs r#7FileInputTests.test_file_opening_hook..str,)rwr@zGFileInput should raise if both inplace and openhook arguments are givenr[r@z2FileInput should check openhook for being callablec \rSrSrSrSrSrg)=FileInputTests.test_file_opening_hook..CustomOpenHooki cSUlgrrr4s r#r5FFileInputTests.test_file_opening_hook..CustomOpenHook.__init__s $ r,c&SUl[USS06$)NTrr)rr)rrkargss r#rFFileInputTests.test_file_opening_hook..CustomOpenHook.__call__s# T4G44r,rNrr&r,r#CustomOpenHookr s  % 5r,rrxzopenhook not invoked)rfailrr$rH assertTruer)rrrtcustom_open_hooks r#test_file_opening_hook%FileInputTests.test_file_opening_hooks 42CDB II@ A A&B IIJ K 5 5 MM$ )+ s%5 6" KKM7 (002HI'       7 6s.BB,&B< B)(B), B98B9< C cT[[S5nURS5 URSS-5 URS5 SSS5 UR[[5 [ [[ S5S9nURUR5S5 URUR5S 5 URUR5S 5 UR[5 [U5 SSS5 URUR5S 5 URUR5S 5 SSS5 g!,(df  GN=f![a URS 5 Nf=f!,(df  N=f!,(df  g=f) NwbsA B C s 123456789 asciirkr@rrC zRead to end of filerC) rrrr safe_unlinkrrrrHUnicodeDecodeErrorrrr~rr"rs r# test_readlineFileInputTests.test_readlines5 &$ 1 GGN # GGNT) * GGG    V, V ,W 57:< 1  6  6  6""#56R7   R[[]B /   R[[]B /77 & 1 /0 16677sU7EFA E'#F8 FAF E$'FFFF F F F'c>[[S5nURS5 SSS5 UR[[5 [ [SS9nUR UR5S5 UR UR5S5 UR UR5S5 UR UR5S5 UR UR5S5 SSS5 g!,(df  N=f!,(df  g=f) NrsA B C DrrsA sB sC Dr,)rrrrrrrrHrs r#test_readline_binary_mode(FileInputTests.test_readline_binary_mode1s &$ 1 GGO $   V, V$ /2   R[[]F 3   R[[]H 5   R[[]G 4   R[[]C 0   R[[]C 0 0 /  0 /sC=B!D= D  Dc|URSSS9n[USSS9nUR5nURUS5 [R R S5 SSS5 [US5nURUR5S5 SSS5 g!,(df  ND=f!,(df  g=f)Ns Initial text.rrrT)rrws New line.) r$rrHrrrrrreadr temp_filefobjrGr"s r#test_inplace_binary_write_mode-FileInputTests.test_inplace_binary_write_mode>sMM"2M> ytT :d==?D   T#3 4 JJ  \ * ; )T "a   QVVX| 4# " ; : # "sAB2!B- B*- B;ctURSSS9n[USSSS9nUR5nURUS5 [ S 5 SSS5 [ US 5nURUR 5RS 5S 5 SSS5 g!,(df  NS=f!,(df  g=f) NsInitial text rrTrreplace)rwrerrorsuInitial text �u New line ˆrs s New line ?)r$rrHrr}rrrstriprs r#test_inplace_encoding_errors+FileInputTests.test_inplace_encoding_errorsHsMM"6TMB y$ ' ;>B==?D   T#8 9 / " ; )T "a   QVVX__W5} E# " ;; # "s.B0B) B&) B7cSnURS5n[U/US9nUR5nSSS5 URWS5 g!,(df  N!=f)Nc.[R"S5$)N(I used to receive only filename and mode)iorr?rs r#old_hookFFileInputTests.test_file_hook_backward_compatibility..old_hookSs;;IJ Jr,rxrr)r$rrHr)rr rrresults r#%test_file_hook_backward_compatibility4FileInputTests.test_file_hook_backward_compatibilityRsN K MM$  sX ."[[]F/ !KL/ .s A  AcURS5nURS5n[X4SS9n[U5nSSS5 URW/SQ5 URWR 5S5 URUR 5S5 URUR S5 g!,(df  N=f) Nrrrrjrrrqr&)r$rr~rrr_filesrs r#test_context_manager#FileInputTests.test_context_managerZs ]]9 % ]]9 % bX 8BHE9  FG !, a( B' 9 8s B33 CcURS5n[USS9n[e!,(df  g=f![a URWRS5 gf=f)NrCrrjr&)r$rOSErrorrr)rrrs r#test_close_on_exception&FileInputTests.test_close_on_exceptiondsQ ]]2  ,g6" 76 ,   RYY + ,s 5$ 255&AAc[/SS9nURURS5 SSS5 g!,(df  g=f)Nrrj)rs)rrr)rrs r#.test_empty_files_list_specified_to_constructor=FileInputTests.test_empty_files_list_specified_to_constructorls. R' 2b   RYY /3 2 2s1 ?c[Rn[[5nUR S5nUR [ US-5 [U/SSS9n[U5 U[lUR5 SSS5 U[lURURS5 g!,(df  N6=f!U[lf=f)zTests invoking FileInput.nextfile() when the attempt to delete the backup file would raise OSError. This error is expected to be silently ignoredrxz.bakTrrvNzos.unlink() was not invoked) osr rrr$rrrrDrrr)ros_unlink_origos_unlink_replacementrrs r#%test_nextfile_oserror_deleting_backup4FileInputTests.test_nextfile_oserror_deleting_backupps  4W = ' d#A OOKV 4!dWER1  F 'BI -555 7FE 'BIs#6B?'B.>B?. B<8B?? C cV[Rn[[5nUR S5n[ U/SSS9nU[lUR 5 SSS5 U[lURURS5 g!,(df  N6=f!U[lf=f)zpTests invoking FileInput.readline() when os.fstat() raises OSError. This exception should be silently discarded.rxTrrvNos.fstat() was not invoked) rfstatrrr$rrHrr)r os_fstat_origos_fstat_replacementrrs r#%test_readline_os_fstat_raises_OSError4FileInputTests.test_readline_os_fstat_raises_OSError 3G< % d#A!dWE/ F%BH ,444 6FE%BH"BB B BB B(cV[Rn[[5nUR S5n[ U/SSS9nU[lUR 5 SSS5 U[lURURS5 g!,(df  N6=f!U[lf=f)zpTests invoking FileInput.readline() when os.chmod() raises OSError. This exception should be silently discarded.rxTrrvNr") rchmodrrr$rrHrr)r os_chmod_origos_chmod_replacementrrs r#%test_readline_os_chmod_raises_OSError4FileInputTests.test_readline_os_chmod_raises_OSErrorr(r)cd"SS[5nU"5nURS5n[U/SS9nURnX$lUR 5nXTlSSS5 UR UR S5 URWSS5 g!XTlf=f!,(df  NI=f) Nc \rSrSrSrSrSrg)QFileInputTests.test_fileno_when_ValueError_raised..FilenoRaisesValueErroric8[RU[5 gr1)rr5rr4s r#r5ZFileInputTests.test_fileno_when_ValueError_raised..FilenoRaisesValueError.__init__s$--dJ?r,c$UR5 gr1)rr4s r#rXFileInputTests.test_fileno_when_ValueError_raised..FilenoRaisesValueError.filenos  r,r&N)r'r(r)r*r5rr+r&r,r#FilenoRaisesValueErrorr2s  @ r,r7rxrrjz_file.fileno() was not invokedrTzfileno() should return -1)rr$r_filerrrr)rr7 unconditionally_raise_ValueErrorrr file_backupr s r#"test_fileno_when_ValueError_raised1FileInputTests.test_fileno_when_ValueError_raiseds %9 ,B+C( MM$  aS7 3r((K ';& 4 8@@8 : %@A ' 4 3s# B!BB!BB!! B/c[5n[SS/URS9nURUR/5 URUR 5S5 URURS/5 URUR 5S5 URURS/5 URUR 5S5 URURSS/5 URUR 5S5 URURS/5 URUR 5S5 URUR/5 SSS5 g!,(df  g=fNz line1 line2zline3 rzline1 line2rC)r.rr@rr8rHrsrcrs r#test_readline_buffering&FileInputTests.test_readline_bufferings"l ni8 # .13   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 /...s EE88 Fc[5n[SS/URS9nURUR/5 UR[ U5S5 URURS/5 UR[ U5S5 URURS/5 UR[ U5S5 URURSS/5 UR [[ U5 URURS/5 UR [[ U5 URUR/5 SSS5 g!,(df  g=fr>)r.rr@rr8rDr StopIterationr@s r#test_iteration_buffering'FileInputTests.test_iteration_bufferingsl ni8 # .13   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 /...s D5E E-c[URS55n[USS9nUR5nUR US5 UR UR 5S5 UR UR 5S5 UR UR5[R"U55 SSS5 g!,(df  g=f)NPath-like file.rrr[) r r$rrHrrrr?rfspath)rrrrGs r#test_pathlike_file!FileInputTests.test_pathlike_files dmm$56 7 rG ,;;=D   T#4 5   RYY[! ,   R]]_a 0   R[[]BIIbM : - , ,s BC Ccj[URS55n[USSS9nUR5nUR US5 [ SU-5 SSS5 [ USS9nUR UR5S5 SSS5 g!,(df  NB=f!,(df  g=f)NrITr)rwrz Modified %srzModified Path-like file. )r r$rrHrr}rr)rrrrGr"s r#test_pathlike_file_inplace)FileInputTests.test_pathlike_file_inplaces dmm$56 7 r4' :b;;=D   T#4 5 -$& ';"w '1   QVVX'C D( ' ; :( 's1B)!B$ B!$ B2r&N)r'r(r)r*rrrrrrrrrrrrrrrrr&r.r;rBrFrKrNr+r&r,r#rrs{()( *) I #J60. 15FM(,07*6$6$B.0 0 ;Er,rc`\rSrSrSrSSSSSS.SjjrSrSrS rS r S r S r S r Sr Srg) MockFileInputizDA class that mocks out fileinput.FileInput for use during unit testsNr)rr@rrcXlX lX0lX@lXPlX`lXplSUl[R"S5Ul 0Ul g)NcgrKr&r&r,r#r(MockFileInput.__init__..sr,) rkrwbackuprr@rrr8 collections defaultdictinvocation_counts return_values)rrkrwrVrr@rrs r#r5MockFileInput.__init__sG        !,!8!8!Cr,c2URS==S- ss'g)NrRr[)rYr4s r#rRMockFileInput.closes w'1,'r,cNURS==S- ss'URS$)Nrr[rYrZr4s r#rMockFileInput.nextfile) z*a/*!!*--r,cNURS==S- ss'URS$)Nr?r[r_r4s r#r?MockFileInput.filename rar,cNURS==S- ss'URS$)Nrr[r_r4s r#rMockFileInput.lineno) x(A-(!!(++r,cNURS==S- ss'URS$)Nrr[r_r4s r#rMockFileInput.filelinenos) |,1,!!,//r,cNURS==S- ss'URS$)Nrr[r_r4s r#rMockFileInput.filenorfr,cNURS==S- ss'URS$)Nrr[r_r4s r#rMockFileInput.isfirstlines) }-2-!!-00r,cNURS==S- ss'URS$)Nrr[r_r4s r#rMockFileInput.isstdins) y)Q.)!!),,r,) r8rVrrrkrwrYrr@rZ)NFrC)r'r(r)r*__doc__r5rRrr?rrrrrr+r&r,r#rQrQs@N  D4  -..,0,1-r,rQc*\rSrSrSrSrSrSrSrg)BaseFileInputGlobalMethodsTesti"zJBase class for unit tests for the global function of the fileinput module.cv[RUl[RUl[ [lgr1) fileinput_state _orig_stater_orig_FileInputrQr4s r#setUp$BaseFileInputGlobalMethodsTest.setUp&s&$++(22+ r,cXUR[lUR[lgr1)rvrsrrurtr4s r#tearDown'BaseFileInputGlobalMethodsTest.tearDown+s"22 ++ r,cURUnURUSU5 [UR5nURUS5 g)Nr[)rYrrL)rmock_file_input method_name actual_countactual_total_counts r#assertExactlyOneInvocation9BaseFileInputGlobalMethodsTest.assertExactlyOneInvocation/sF&88E  q+6 !B!BC +Q/r,)rvruN) r'r(r)r*rorwrzrr+r&r,r#rqrq"s , ,0r,rqc0\rSrSrSrSrSrSrSrSr g) Test_fileinput_inputi7z Unit tests for fileinput.input()cb[5n[5UlU[lUR [ 5n[R"5 SSS5 URSWRR5 URU[RS5 g!,(df  NV=f)zTests invoking fileinput.input() when fileinput._state is not None and its _file attribute is also not None. Expect RuntimeError to be raised with a meaningful error message and for fileinput._state to *not* be modified.N)zinput() already activefileinput._state) rQobjectr8rsrtr RuntimeErrorinputr exceptionrassertIs)rinstancecms r#1test_state_is_not_None_and_state_file_is_not_NoneFTest_fileinput_input.test_state_is_not_None_and_state_file_is_not_None:sv !?#    | , OO - 4bll6G6GH h 0 02DE- ,s B  B.c\[5nSUlU[lUR 5 g)a0Tests invoking fileinput.input() when fileinput._state is not None but its _file attribute *is* None. Expect it to create and return a new fileinput.FileInput object with all method parameters passed explicitly to the __init__() method; also ensure that fileinput._state is set to the returned instance.N)rQr8rsrtdo_test_call_inputrrs r#-test_state_is_not_None_and_state_file_is_NoneBTest_fileinput_input.test_state_is_not_None_and_state_file_is_NoneGs& !?#  !r,c:S[lUR5 g)aTests invoking fileinput.input() when fileinput._state is None Expect it to create and return a new fileinput.FileInput object with all method parameters passed explicitly to the __init__() method; also ensure that fileinput._state is set to the returned instance.N)rsrtrr4s r#test_state_is_None'Test_fileinput_input.test_state_is_NoneRs   !r,c [5n[5n[5n[5n[5n[5n[R"XUXEUS9nURU[RS5 URXR S5 URX'R S5 URX7RS5 URXGRS5 URXWRS5 g) zTests that fileinput.input() creates a new fileinput.FileInput object, passing the given parameters unmodified to fileinput.FileInput.__init__(). Note that this test depends on the monkey patching of fileinput.FileInput done by setUp().)rkrwrVrr@rrrkrwrVrr@N) rrsrrrtrkrwrVrr@)rrkrwrVrr@rr s r#r'Test_fileinput_input.do_test_call_input[s (x88uf8= fi..0BC e\\73 g~~y9 fmmX6 dKK0 hF%DI 88!< 77:JB9OP&DI B B%c[RnS[l[R"SSSS9nU[lUR [ U5S/5 g!U[lf=f)Nc.[R"S5$)NsEx-binary string)r rr s r#rATest_hook_compressed.test_gz_with_encoding_fake..ms2::6I+Jr,rrRrrzEx-binary string)rrrsrrr~rs r#test_gz_with_encoding_fake/Test_hook_compressed.test_gz_with_encoding_fakejsU J  &..y#PF%DI f(:';<&DIs A A)z Requires bz2cP[RnUR[l[R"SS5nU[lUR URR S5 UR URRS045 g!U[lf=f)Ntest.bz2rRr[)rrR)bz2BZ2Filerrsrrrrrs r#test_bz2_ext_fake&Test_hook_compressed.test_bz2_ext_faketsy nn  (..z3?F'CK 88!< 77:KR9PQ(CKrc(URSS5 g)Nz abcd.blahrdo_test_use_builtin_open_binaryr4s r# test_blah_ext"Test_hook_compressed.test_blah_exts ,,[$?r,c(URSS5 g)Nzabcd.Gzrr r4s r#test_gz_ext_builtin(Test_hook_compressed.test_gz_ext_builtins ,,Y=r,c(URSS5 g)Nzabcd.Bz2rr r4s r#test_bz2_ext_builtin)Test_hook_compressed.test_bz2_ext_builtins ,,Z>r,c(URSS5 g)Nrrr r4s r#test_binary_mode_encoding.Test_hook_compressed.test_binary_mode_encodings ,,VT:r,c(URSS5 grrr4s r#test_text_mode_encoding,Test_hook_compressed.test_text_mode_encodingrr,cZURUR5n[R"X5nURU5 UR URR S5 UR URR X4SSS.45 g!URU5 f=f)Nr[rrreplace_builtin_openrrsrrrrrr?rrr s r#r 4Test_hook_compressed.do_test_use_builtin_open_binarys11$..A  5..x>F  % %m 4 88!< 77#*,NO Q  % %m 4 BB*cZURUR5n[R"X5nURU5 UR URR S5 UR URR X4SSS.45 g!URU5 f=f)Nr[localerrrs r#r2Test_hook_compressed.do_test_use_builtin_open_texts11$..A  5..x>F  % %m 4 88!< 77#*T,RS U  % %m 4rc<[RnU[lU$r1)builtinsr) new_open_funcrs r#r)Test_hook_compressed.replace_builtin_opens % r,)rN)r'r(r)r*rorwrrunittest skipUnlessrrrrrr rrrrr r staticmethodrr+r&r,r#rrRs4.4878 Q9 Q78=9=n- R. R@>?;8 Q Ur,rc*\rSrSrSrSrSrSrSrg)Test_hook_encodediz'Unit tests for fileinput.hook_encoded()c\[5n[5n[R"XS9n[5n[R nU[l[5n[5nU"Xg5nU[lUR URS5 URupURU SU5 URU SU5 URU RS5U5 URU RS5U5 URU 5 g!U[lf=f)Nrr[rrr) rrsrrr$rrrrrpopr) rrrr rrr?r open_resultrrs r#testTest_hook_encoded.tests8''@&(  !  *xH8D 0K)HM 33Q7 00  d1gx( d1gt$ fjj,h7 fjj*F3  *HMs D D+cj^[[S5nURS5 SSS5 TR[[5 U4SjnU"SS/5 TR [ 5 U"SS/5 SSS5 U"SS/5 U"S S /5 g!,(df  Nu=f!,(df  N4=f) Nrsabcc >[[S[SUS9S9n[U5nSSS5 TR WU5 g!,(df  N!=f)NrRrr-rkrr@rrrr~r)rexpected_linesrrNrs r#check,Test_hook_encoded.test_errors..checksKc$0$HJMORJ   UN 3JJs A Aignoreabcstrictru�abcbackslashreplacez\x80abc)rrrrrrrrr"r7s` r# test_errorsTest_hook_encoded.test_errorss &$ 1 GGJ    V, 4 h   1 2 (UG $3 i+'  :,/ 3 2sB+ B$ B!$ B2cF^[[S5nURS5 SSS5 TR[[5 U4SjnU"S/SQ5 TR [ 5 U"S/SQ5 SSS5 g!,(df  Nc=f!,(df  g=f)Nrs A B C D+IKw-c>[[U[S5S9n[U5nSSS5 TR WU5 g!,(df  N!=f)Nzutf-7r4r5)rr6rrNrs r#r7+Test_hook_encoded.test_modes..checksEd$0$9;>@R;   UN 3;;s A ArR)rrrD€r)rzB zC rC)rrrrrrrr=s` r# test_modesTest_hook_encoded.test_modessv &$ 1 GG( )   V, 4 c34   z * $: ;+ * + *sB, B B B r&N) r'r(r)r*ror0r>rDr+r&r,r#r+r+s1!00"rRs !- 38"  " " HQy("3"3Qf$$EY 1 1ED ----^0X%6%60*==9==~,9,&2<262<262:262 >262:282!?262;26))W8,,Wr:<)):