+
    Biq                     l   ^ RI t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt ^ RI	t	 ^ RIt^ RI HtHt ^ RIHtHt ^ RIHt ^ RIHtHt ^ RIHt ^ RIHt ^ RIHt ^ R	IHt  ! R
 R4      t ! R R4      t ! R R]]P:                  4      t ! R R4      t ! R R]]P:                  4      t  ! R R4      t! ! R R]P:                  4      t" ! R R]"4      t# ! R R]"4      t$ ! R R]"4      t% ! R R]"4      t& ! R  R!]"4      t' ! R" R#]"4      t( ! R$ R%]"4      t) ! R& R']"4      t* ! R( R)]"4      t+ ! R* R+4      t, ! R, R-]P:                  4      t- ! R. R/]P:                  4      t. ! R0 R1]P:                  4      t/]0R28X  d   ]Pb                  ! 4        R# R#   ]
 d    Rt	 ELxi ; i  ]
 d    Rt ELi ; i)3    N)BytesIOStringIO)	FileInputhook_encoded)verbose)TESTFNFakePath)unlink)	os_helper)support)mockc                   .   a  ] tR t^'t o RR/R ltRtV tR# )	BaseTestsmodewc                  \         P                  ! 4       w  r4V P                  \        P                  V4       R V9   d   RMRp\        W2VR7      ;_uu_ 4       pVP                  V4       RRR4       V#   + '       g   i     T# ; i)bNutf-8encoding)tempfilemkstemp
addCleanupr   r
   openwrite)selfcontentr   fdnamer   fs   &&$    */usr/lib/python3.14/test/test_fileinput.pywriteTmpBaseTests.writeTmp*   sf    ##%	(($/$;4G"X..!GGG / /.s   A44B	 N)__name__
__module____qualname____firstlineno__r"   __static_attributes____classdictcell____classdict__s   @r!   r   r   '   s           r   c                   V   a  ] tR t^2t o R t]R 4       tR tR	R ltR
R lt	R t
RtV tR# )
LineReaderc                    . V n         R # N
_linesreadr   s   &r!   __init__LineReader.__init__4   s	    r-   c                P     V P                   R ,          . V n         #   . T n         i ; i):NNNr2   r4   s   &r!   	linesreadLineReader.linesread7   s"    	!??1% DObDOs    	%c                D    \        VP                  R 4      4      V n        V # T)iter
splitlinesit)r   filenamer   s   &&&r!   openhookLineReader.openhook>   s    x**401r-   Nc                h    \        V P                  R 4      pV P                  P                  V4       V# ) )nextr>   r3   append)r   sizelines   && r!   readlineLineReader.readlineB   s)    DGGR t$r-   c                    . p^ p V P                  4       pV'       g   V# VP                  V4       V\        V4      ,          pW18  g   KF  V# r   )rH   rE   len)r   hintlinesrF   rG   s   &&   r!   	readlinesLineReader.readlinesG   sF    ==?DLLCID|r-   c                    R # r1   r$   r4   s   &r!   closeLineReader.closeS   s    r-   )r3   r>   r1   ))r%   r&   r'   r(   r5   propertyr8   r@   rH   rO   rR   r)   r*   r+   s   @r!   r/   r/   2   s7      ! !

 r-   r/   c                   &   a  ] tR t^Vt o R tRtV tR# )BufferSizesTestsc                t   V P                  R P                  R \        ^4       4       4      4      pV P                  R P                  R \        ^
4       4       4      4      pV P                  R P                  R \        ^4       4       4      4      pV P                  R P                  R \        ^4       4       4      4      p\        P                  ! R4      p\
        '       d   \        R4       \        WW43RR7      p\        V4      pVP                  4        V P                  \        V4      ^4       V P                  V^,          R	4       V P                  V^,          R
4       V P                  VP                  4       ^4       V P                  VP                  4       V4       \
        '       d   \        R4       \        WW43RR7      pRpV'       d   VR8w  d   VP                  4       pK!  V P                  VP                  4       V4       V P                  VP                  4       ^4       V P                  VP                  4       ^4       V P!                  VP#                  4       4       V P!                  VP%                  4       4       \
        '       d   \        R4       VP'                  4        V P                  VP                  4       R4       V P                  VP                  4       ^4       VP                  4        \
        '       d   \        R4       \        WW4R3RR7      p\(        P*                  p	 \-        R4      \(        n        \        V4      pV P                  \        V4      ^!4       V P                  V^ ,          R4       V P                  VP                  4       R4       VP'                  4        V	\(        n        \
        '       d   \        R4       \        WW43RR7      pV P                  VP                  4       ^ 4       V P                  VP                  4       R4       VP'                  4        V P                  VP                  4       ^ 4       V P                  VP                  4       R4       \
        '       d   \        R4       \(        P.                  p
 \        WW43RRR7      pV F!  pVRR P1                  4       p\        V4       K#  	  VP                  4        V
\(        n        \        WW43RR7      pV Fz  pV P                  VR,          R4       VP3                  VRR 4      pV P5                  VR4       V P                  \7        VP9                  ^4      4      VP                  4       4       K|  	  VP                  4        R#   T	\(        n        i ; i  T
\(        n        i ; i)rC   c              3   B   "   T F  pR V^,           ,          x  K  	  R# 5i)zLine %s of file 1
Nr$   .0is   & r!   	<genexpr>5BufferSizesTests.test_buffer_sizes.<locals>.<genexpr>Y        "T)Q#8AaC#@#@)   c              3   B   "   T F  pR V^,           ,          x  K  	  R# 5i)zLine %s of file 2
Nr$   rZ   s   & r!   r]   r^   Z   r_   r`   c              3   B   "   T F  pR V^,           ,          x  K  	  R# 5i)zLine %s of file 3
Nr$   rZ   s   & r!   r]   r^   [        "S(Q#8AaC#@#@(r`   c              3   B   "   T F  pR V^,           ,          x  K  	  R# 5i)zLine %s of file 4
Nr$   rZ   s   & r!   r]   r^   \   rc   r`   zLINE (\d+) OF FILE (\d+)z1. Simple iterationr   filesr   zLine 5 of file 1
zLine 1 of file 4
z2. Status variablesxzLine 6 of file 2
z3. NextfilezLine 1 of file 3
z4. Stdin-z Line 1 of stdin
Line 2 of stdin
zLine 2 of stdin
z<stdin>z5. Boundary conditionsNz
6. InplaceTrf   inplacer   
rT   )r"   joinrangerecompiler   printr   listrR   assertEqualrL   linenor?   rH   
filelinenoassertFalseisfirstlineisstdinnextfilesysstdinr   stdoutuppermatchassertNotEqualintgroup)r   t1t2t3t4patfirN   s	savestdin
savestdoutrG   ms   &            r!   test_buffer_sizes"BufferSizesTests.test_buffer_sizesW   s0   ]]277"T%PR)"TTU]]277"T%PR)"TTU]]277"S%PQ("SST]]277"S%PQ("SSTjj457'(bb-@R

UR(q#78r$89b)+7'(bb-@A--A+b)!,)*&7- 
(<=b)

7*bbc2WEII		" !EFCIHESZ,U2Y(;<R[[]I6KKM!CI7*+bb-@a(-
a(-7,ZZ
	$""!14'RBCRy(d  HHJ#CJbb-@DT"Xt,		$s)$A4(S_bmmo>	 
 	
; "CI* $CJs   ;BV 'AV* V'*V7r$   N)r%   r&   r'   r(   r   r)   r*   r+   s   @r!   rW   rW   V   s     P Pr-   rW   c                   ,   a  ] tR t^t o R tR tRtV tR# )UnconditionallyRaisec                     Wn         R V n        R# FNexception_typeinvoked)r   r   s   &&r!   r5   UnconditionallyRaise.__init__   s    ,r-   c                0    R V n         V P                  4       hr;   )r   r   r   argskwargss   &*,r!   __call__UnconditionallyRaise.__call__   s    !!##r-   r   Nr%   r&   r'   r(   r5   r   r)   r*   r+   s   @r!   r   r      s     $ $r-   r   c                      a  ] tR t^t o R tR tR tR tR tR t	R t
R tR	 tR
 tR tR tR tR tR tR tR tR tR tR tR tR tR tRtV tR# )FileInputTestsc                   V P                  R 4      pV P                  R 4      pV P                  R4      pV P                  R 4      p\        WW43RR7      pVP                  4       pV P                  VR4       V P                  VP	                  4       ^4       V P                  VP                  4       ^4       V P                  VP                  4       V4       VP                  4       pV P                  V4       V P                  VP	                  4       ^4       V P                  VP                  4       ^ 4       V P                  VP                  4       V4       VP                  4        R# )rC   zThe only line there is.
r   re   N)	r"   r   rH   rr   rs   rt   r?   ru   rR   )r   r   r   r   r   r   rG   s   &      r!   test_zero_byte_files#FileInputTests.test_zero_byte_files   s   ]]2]]2]]67]]2bb-@{{}:;a(!,+{{}a(!,+

r-   c                $   V P                  R 4      pV P                  R4      p\        W3RR7      p\        V4      pV P                  V. RO4       V P                  VP	                  4       ^4       V P                  VP                  4       ^4       R# )A
B
CD
E
Fr   re   NA
B
CzD
zE
F)r"   r   rq   rr   rt   rs   r   r   r   r   rN   s   &    r!   %test_files_that_dont_end_with_newline4FileInputTests.test_files_that_dont_end_with_newline   sr    ]]9%]]9%bX8R FG!,a(r-   c                   V P                  R 4      pV P                  R4      p\        W3RR7      pV P                  VP                  4       R4       \	        V4      pV P                  VP                  4       R4       VP                  4        V P                  VP                  4       R4       \        V4      pV P                  VP                  4       R4       R# )zA
BzC
Dr   re   NrT   )r"   r   rr   filenorD   r~   rx   rq   )r   r   r   r   rG   s   &    r!   test_filenoFileInputTests.test_fileno   s    ]]6"]]6"bX8b)BxBIIK,
b)Bxb)r-   c           
        R FX  pV P                  VR7      ;_uu_ 4        V P                  \        4      ;_uu_ 4        \        VR7       RRR4       RRR4       KZ  	  R#   + '       g   i     L; i  + '       g   i     K  ; i)r   r   N)r   rUU)subTestassertRaises
ValueErrorr   )r   r   s   & r!   test_invalid_opening_mode(FileInputTests.test_invalid_opening_mode   sV    $D4((&&z224( 3 )( %22 )((s"   A4A!A4!A1,A44Bc                    \         P                  ! R 4      ;_uu_ 4       p\        R4      Vn        \	        R.RR7      p\        V4      pV P                  VR.4       RRR4       R#   + '       g   i     R# ; i)z	sys.stdin   spam, bacon, sausage, and spamrh   rbrf   r   N)r   patchr   bufferr   rq   rr   )r   m_stdinr   rN   s   &   r!   test_stdin_binary_mode%FileInputTests.test_stdin_binary_mode   sZ    ZZ$$$%FGGN#T2BHEU%F$GH	 %$$$s   =A&&A7	c                   \         P                  p \        R 4      \         n        V P                  \         P                  R4       \	        R.RR7      p\        V4      pV P                  VR .4       V\         n        R#   T\         n        i ; i)r   r   rh   r   r   N)ry   rz   r   assertNotHasAttrr   rq   rr   )r   
orig_stdinr   rN   s   &   r!   test_detached_stdin_binary_mode.FileInputTests.test_detached_stdin_binary_mode   sk    YY
	# ABCI!!#))X6#T2BHEU%F$GH"CI
CIs   A A? ?Bc                    \        R R R7      pV P                  R4        \        ^R7      pV P                  R4        ! R R4      pV P                  R4      pV! 4       p\        V.VR7      ;_uu_ 4       pVP	                  4        R	R	R	4       V P                  VP                  R
4       R	#   \         d     Li ; i  \         d     Li ; i  + '       g   i     LP; i)Tc                     R # r1   r$   )r    r   s   &&r!   <lambda>7FileInputTests.test_file_opening_hook.<locals>.<lambda>  s    tr-   )rj   r@   zGFileInput should raise if both inplace and openhook arguments are givenr@   z2FileInput should check openhook for being callablec                   ,   a  ] tR tRt o R tR tRtV tR# )=FileInputTests.test_file_opening_hook.<locals>.CustomOpenHooki  c                    R V n         R# r   r   r4   s   &r!   r5   FFileInputTests.test_file_opening_hook.<locals>.CustomOpenHook.__init__  s	    $r-   c                &    R V n         \        VRR/ # )Tr   r   )r   r   )r   r   kargss   &*,r!   r   FFileInputTests.test_file_opening_hook.<locals>.CustomOpenHook.__call__  s    #T4G44r-   r   Nr   r+   s   @r!   CustomOpenHookr     s     %5 5r-   r   rk   Nzopenhook not invoked)r   failr   r"   rH   
assertTruer   )r   r   r   tcustom_open_hooks   &    r!   test_file_opening_hook%FileInputTests.test_file_opening_hook   s    	42CDBII @ A	A&BIIJK	5 	5 MM$)+s%566"KKM 7(002HI'  		
  		 76s.   B. B? 7C.B<;B<?CCC 	c           	        \        \        R 4      ;_uu_ 4       pVP                  R4       VP                  RR,          4       VP                  R4       RRR4       V P                  \        \        4       \        \        \        R4      R7      ;_uu_ 4       p V P                  VP                  4       R4       V P                  VP                  4       R	4       V P                  VP                  4       R
4       V P                  \        4      ;_uu_ 4        \        V4       RRR4       V P                  VP                  4       R4       V P                  VP                  4       R4       RRR4       R#   + '       g   i     EL*; i  \         d    T P                  R4        Li ; i  + '       g   i     L; i  + '       g   i     R# ; i)wbs   A
B
Cs
   123456789
     Nasciirf   r@   r   r   C
zRead to end of filerC   )r   r   r   r   safe_unlinkr   r   rr   rH   UnicodeDecodeErrorr   r   rq   r   r    r   s   &  r!   test_readlineFileInputTests.test_readline  sH   &$1GGN#GGNT)*GGG   	V,V ,W 57 7:<1  6  6  6 ""#566R 7 R[[]B/R[[]B/7 7   & 1		/01667 7 7sU   ;E5F>A F	:F>F+	#AF>5F		F(%F>'F((F>+F;6F>>G	c                p   \        \        R 4      ;_uu_ 4       pVP                  R4       RRR4       V P                  \        \        4       \        \        RR7      ;_uu_ 4       pV P                  VP                  4       R4       V P                  VP                  4       R4       V P                  VP                  4       R4       V P                  VP                  4       R4       V P                  VP                  4       R4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)	r   s   A
B
CDNr   r   s   A
s   B
s   CDr-   )r   r   r   r   r   r   rr   rH   r   s   &  r!   test_readline_binary_mode(FileInputTests.test_readline_binary_mode1  s    &$1GGO$  V,V$//2R[[]F3R[[]H5R[[]G4R[[]C0R[[]C0 0/	   0//s   D&B!D$D!	$D5	c                   V P                  R RR7      p\        VRRR7      ;_uu_ 4       pVP                  4       pV P                  VR 4       \        P
                  P                  R4       RRR4       \        VR4      ;_uu_ 4       pV P                  VP                  4       R4       RRR4       R#   + '       g   i     LO; i  + '       g   i     R# ; i)s   Initial text.r   r   r   T)r   rj   s	   New line.N)	r"   r   rH   rr   ry   r{   r   r   readr   	temp_filefobjrG   r    s   &    r!   test_inplace_binary_write_mode-FileInputTests.test_inplace_binary_write_mode>  s    MM"2M>	ytT::d==?DT#34JJ\*	 ;
 )T""aQVVX|4 #" ;:
 #""s   AB3!C3C	C	c                   V P                  R RR7      p\        VRRRR7      ;_uu_ 4       pVP                  4       pV P                  VR4       \	        R4       R	R	R	4       \        VR
4      ;_uu_ 4       pV P                  VP                  4       P                  R4      R4       R	R	R	4       R	#   + '       g   i     L^; i  + '       g   i     R	# ; i)s   Initial text r   r   Tr   replace)rj   r   errorsu   Initial text �u   New line Nr   s   
s
   New line ?)r"   r   rH   rr   rp   r   r   rstripr   s   &    r!   test_inplace_encoding_errors+FileInputTests.test_inplace_encoding_errorsH  s    MM"6TMB	y$ '	; ;>B==?DT#89/"	;
 )T""aQVVX__W5}E #"; ;
 #""s   .B/50C/B?	C	c                    R  pV P                  R4      p\        V.VR7      ;_uu_ 4       pVP                  4       pRRR4       V P                  XR4       R#   + '       g   i     L$; i)c                 .    \         P                  ! R 4      # )(I used to receive only filename and mode)ior   r?   r   s   &&r!   old_hookFFileInputTests.test_file_hook_backward_compatibility.<locals>.old_hookS  s    ;;IJJr-   rk   r   Nr   )r"   r   rH   rr   )r   r   r   r   results   &    r!   %test_file_hook_backward_compatibility4FileInputTests.test_file_hook_backward_compatibilityR  sQ    	KMM$sX.."[[]F /!KL /.s   AA(	c                   V P                  R 4      pV P                  R4      p\        W3RR7      ;_uu_ 4       p\        V4      pRRR4       V P                  X. RO4       V P                  XP	                  4       ^4       V P                  VP                  4       ^4       V P                  VP                  R4       R#   + '       g   i     L; i)r   r   r   re   Nr   r$   )r"   r   rq   rr   rt   rs   _filesr   s   &    r!   test_context_manager#FileInputTests.test_context_managerZ  s    ]]9%]]9%bX88BHE 9 FG!,a(B' 98s   B??C	c                    V P                  R 4      p \        VRR7      ;_uu_ 4       p\        h  + '       g   i     R# ; i  \         d!    T P                  XP                  R4        R# i ; i)rC   r   re   Nr$   )r"   r   OSErrorrr   r  )r   r   r   s   &  r!   test_close_on_exception&FileInputTests.test_close_on_exceptiond  sW    ]]2	,g66" 766 	,RYY+	,s%   A /A 	A  A 'A.-A.c                    \        . R R7      ;_uu_ 4       pV P                  VP                  R4       RRR4       R#   + '       g   i     R# ; i)r   re   N)rh   )r   rr   r  )r   r   s   & r!   .test_empty_files_list_specified_to_constructor=FileInputTests.test_empty_files_list_specified_to_constructorl  s4    R'22bRYY/ 3222s	   =A	c                   \         P                  p\        \        4      p V P	                  R 4      pV P                  \        VR,           4       \        V.RRR7      ;_uu_ 4       p\        V4       V\         n        VP                  4        RRR4       V\         n        V P                  VP                  R4       R#   + '       g   i     L9; i  T\         n        i ; i)rk   z.bakTr   ri   Nzos.unlink() was not invoked)osr
   r   r  r"   r   r   r   rD   rx   r   r   )r   os_unlink_origos_unlink_replacementr   r   s   &    r!   %test_nextfile_oserror_deleting_backup4FileInputTests.test_nextfile_oserror_deleting_backupp  s    
  4W =	'd#AOOKV4!dWEER1	 F
 'BI 	-555	7 FE
 'BIs$   AC &'B>C >C		C Cc                r   \         P                  p\        \        4      p V P	                  R 4      p\        V.RRR7      ;_uu_ 4       pV\         n        VP                  4        RRR4       V\         n        V P                  VP                  R4       R#   + '       g   i     L9; i  T\         n        i ; irk   Tr   ri   Nzos.fstat() was not invoked)	r  fstatr   r  r"   r   rH   r   r   )r   os_fstat_origos_fstat_replacementr   r   s   &    r!   %test_readline_os_fstat_raises_OSError4FileInputTests.test_readline_os_fstat_raises_OSError       3G<	%d#A!dWEE/ F %BH 	,444	6 FE %BH#   (B) 	B%B) B&	!B) )B6c                r   \         P                  p\        \        4      p V P	                  R 4      p\        V.RRR7      ;_uu_ 4       pV\         n        VP                  4        RRR4       V\         n        V P                  VP                  R4       R#   + '       g   i     L9; i  T\         n        i ; ir  )	r  chmodr   r  r"   r   rH   r   r   )r   os_chmod_origos_chmod_replacementr   r   s   &    r!   %test_readline_os_chmod_raises_OSError4FileInputTests.test_readline_os_chmod_raises_OSError  r  r  c                    ! R  R\         4      pV! 4       pV P                  R4      p\        V.RR7      ;_uu_ 4       pVP                  p W$n        VP	                  4       pWTn         RRR4       V P                  VP                  R4       V P                  XRR4       R#   YTn        i ; i  + '       g   i     LL; i)	c                   ,   a  ] tR tRt o R tR tRtV tR# )QFileInputTests.test_fileno_when_ValueError_raised.<locals>.FilenoRaisesValueErrori  c                :    \         P                  V \        4       R # r1   )r   r5   r   r4   s   &r!   r5   ZFileInputTests.test_fileno_when_ValueError_raised.<locals>.FilenoRaisesValueError.__init__  s    $--dJ?r-   c                &    V P                  4        R # r1   )r   r4   s   &r!   r   XFileInputTests.test_fileno_when_ValueError_raised.<locals>.FilenoRaisesValueError.fileno  s    r-   r$   N)r%   r&   r'   r(   r5   r   r)   r*   r+   s   @r!   FilenoRaisesValueErrorr#    s     @   r-   r(  rk   r   re   Nz_file.fileno() was not invokedzfileno() should return -1rT   )r   r"   r   _filer   r   r   rr   )r   r(   unconditionally_raise_ValueErrorr   r   file_backupr   s   &      r!   "test_fileno_when_ValueError_raised1FileInputTests.test_fileno_when_ValueError_raised  s    	 %9 	  ,B+C(MM$aS733r((K';& 4 	8@@8	: 	%@A ' 43s#   B-B""B-"B**B--B=	c                0   \        4       p\        R R.VP                  R7      ;_uu_ 4       pV P                  VP                  . 4       V P                  VP                  4       R4       V P                  VP                  R.4       V P                  VP                  4       R4       V P                  VP                  R.4       V P                  VP                  4       R4       V P                  VP                  RR.4       V P                  VP                  4       R4       V P                  VP                  R.4       V P                  VP                  4       R4       V P                  VP                  . 4       RRR4       R#   + '       g   i     R# ; izline1
line2zline3
r   zline1
line2rC   N)r/   r   r@   rr   r8   rH   r   srcr   s   &  r!   test_readline_buffering&FileInputTests.test_readline_buffering  s,   lni8 #. .13S]]B/R[[]I6S]]YK8R[[]G4S]]WI6R[[]I6S]]RO<R[[]B/S]]RD1R[[]B/S]]B/. . . .s   EFF	c                   \        4       p\        R R.VP                  R7      ;_uu_ 4       pV P                  VP                  . 4       V P                  \        V4      R4       V P                  VP                  R.4       V P                  \        V4      R4       V P                  VP                  R.4       V P                  \        V4      R4       V P                  VP                  RR.4       V P                  \        \
        V4       V P                  VP                  R.4       V P                  \        \
        V4       V P                  VP                  . 4       RRR4       R#   + '       g   i     R# ; ir/  )r/   r   r@   rr   r8   rD   r   StopIterationr1  s   &  r!   test_iteration_buffering'FileInputTests.test_iteration_buffering  s   lni8 #. .13S]]B/T"Xy1S]]YK8T"Xw/S]]WI6T"Xy1S]]RO<mT26S]]RD1mT26S]]B/. . . .s   D5E++E<	c                   \        V P                  R 4      4      p\        VRR7      ;_uu_ 4       pVP                  4       pV P	                  VR 4       V P	                  VP                  4       ^4       V P	                  VP                  4       ^4       V P	                  VP                  4       \        P                  ! V4      4       RRR4       R#   + '       g   i     R# ; i)Path-like file.r   r   N)
r	   r"   r   rH   rr   rs   rt   r?   r  fspath)r   r   r   rG   s   &   r!   test_pathlike_file!FileInputTests.test_pathlike_file  s    dmm$567rG,,;;=DT#45RYY[!,R]]_a0R[[]BIIbM: -,,,s   BCC"	c                   \        V P                  R 4      4      p\        VRRR7      ;_uu_ 4       pVP                  4       pV P	                  VR 4       \        RV,          4       RRR4       \        VRR7      ;_uu_ 4       pV P	                  VP                  4       R4       RRR4       R#   + '       g   i     LP; i  + '       g   i     R# ; i)r:  Tr   )rj   r   zModified %sNr   zModified Path-like file.
)r	   r"   r   rH   rr   rp   r   r   )r   r   r   rG   r    s   &    r!   test_pathlike_file_inplace)FileInputTests.test_pathlike_file_inplace  s    dmm$567r4'::b;;=DT#45-$&' ; "w''1QVVX'CD ('	 ;: (''s   5B.!C.B>	C	r$   N)r%   r&   r'   r(   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r
  r  r  r  r,  r3  r7  r<  r?  r)   r*   r+   s   @r!   r   r      s     ()(
*)I	#J60.15FM(,07*6$6$B.0 0 ;E Er-   r   c            	       n   a  ] tR tRt o RRRRRRRRR/R lltR	 tR
 tR tR tR t	R t
R tR tRtV tR# )MockFileInputi  Nr   rr@   r   r   c                   Wn         W n        W0n        W@n        WPn        W`n        Wpn        R V n        \        P                  ! R 4      V n
        / V n        R # )Nc                      ^ # rK   r$   r$   r-   r!   r   (MockFileInput.__init__.<locals>.<lambda>   s    r-   )rf   rj   backupr   r@   r   r   r)  collectionsdefaultdictinvocation_countsreturn_values)r   rf   rj   rG  r   r@   r   r   s   &&&&$$$$r!   r5   MockFileInput.__init__  sG    
	  
!,!8!8!Cr-   c                D    V P                   R ;;,          ^,          uu&   R# rR   N)rJ  r4   s   &r!   rR   MockFileInput.close  s    w'1,'r-   c                f    V P                   R ;;,          ^,          uu&   V P                  R ,          # )rx   rJ  rK  r4   s   &r!   rx   MockFileInput.nextfile  )    z*a/*!!*--r-   c                f    V P                   R ;;,          ^,          uu&   V P                  R ,          # )r?   rQ  r4   s   &r!   r?   MockFileInput.filename
  rS  r-   c                f    V P                   R ;;,          ^,          uu&   V P                  R ,          # )rs   rQ  r4   s   &r!   rs   MockFileInput.lineno  )    x(A-(!!(++r-   c                f    V P                   R ;;,          ^,          uu&   V P                  R ,          # )rt   rQ  r4   s   &r!   rt   MockFileInput.filelineno  s)    |,1,!!,//r-   c                f    V P                   R ;;,          ^,          uu&   V P                  R ,          # )r   rQ  r4   s   &r!   r   MockFileInput.fileno  rX  r-   c                f    V P                   R ;;,          ^,          uu&   V P                  R ,          # )rv   rQ  r4   s   &r!   rv   MockFileInput.isfirstline  s)    }-2-!!-00r-   c                f    V P                   R ;;,          ^,          uu&   V P                  R ,          # )rw   rQ  r4   s   &r!   rw   MockFileInput.isstdin  s)    y)Q.)!!),,r-   )
r)  rG  r   r   rf   rj   rJ  r   r@   rK  )NFrC   )r%   r&   r'   r(   r5   rR   rx   r?   rs   rt   r   rv   rw   r)   r*   r+   s   @r!   rB  rB    sW       $( 37 @D -..,0,1- -r-   rB  c                   2   a  ] tR tRt o R tR tR tRtV tR# )BaseFileInputGlobalMethodsTesti"  c                x    \         P                  V n        \         P                  V n        \
        \         n        R # r1   )	fileinput_state_orig_stater   _orig_FileInputrB  r4   s   &r!   setUp$BaseFileInputGlobalMethodsTest.setUp&  s&    $++(22+	r-   c                Z    V P                   \        n        V P                  \        n        R # r1   )rg  rd  r   rf  re  r4   s   &r!   tearDown'BaseFileInputGlobalMethodsTest.tearDown+  s    "22	++	r-   c                    VP                   V,          pV P                  V^V4       \        VP                   4      pV P                  V^4       R# )   N)rJ  rr   rL   )r   mock_file_inputmethod_nameactual_countactual_total_counts   &&&  r!   assertExactlyOneInvocation9BaseFileInputGlobalMethodsTest.assertExactlyOneInvocation/  sF    &88Eq+6 !B!BC+Q/r-   )rg  rf  N)	r%   r&   r'   r(   rh  rk  rs  r)   r*   r+   s   @r!   rb  rb  "  s     ,
,0 0r-   rb  c                   8   a  ] tR tRt o R tR tR tR tRtV t	R# )Test_fileinput_inputi7  c                x   \        4       p\        4       Vn        V\        n        V P                  \        4      ;_uu_ 4       p\        P                  ! 4        R R R 4       V P                  RXP                  P                  4       V P                  V\        P                  R4       R #   + '       g   i     LY; i)Nfileinput._state)zinput() already active)rB  objectr)  rd  re  r   RuntimeErrorinputrr   	exceptionr   assertIs)r   instancecms   &  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:  sy    
 !?#	|,,OO -4bll6G6GHh	 0 02DE -,s   B))B9	c                ^    \        4       pR Vn        V\        n        V P	                  4        R # r1   )rB  r)  rd  re  do_test_call_inputr   r~  s   & r!   -test_state_is_not_None_and_state_file_is_NoneBTest_fileinput_input.test_state_is_not_None_and_state_file_is_NoneG  s&     !?#	!r-   c                <    R \         n        V P                  4        R # r1   )rd  re  r  r4   s   &r!   test_state_is_None'Test_fileinput_input.test_state_is_NoneR  s      	!r-   c           	        \        4       p\        4       p\        4       p\        4       p\        4       p\        4       p\        P                  ! WVWEVR 7      pV P                  V\        P                  R4       V P                  WP
                  R4       V P                  W'P                  R4       V P                  W7P                  R4       V P                  WGP                  R4       V P                  WWP                  R4       R# ))rf   rj   rG  r   r@   r   rx  rf   rj   rG  r   r@   N)
ry  rd  r{  r}  re  rf   rj   rG  r   r@   )r   rf   rj   rG  r   r@   r   r   s   &       r!   r  'Test_fileinput_input.do_test_call_input[  s    
 (x88 uf8= 	fi..0BC 	e\\73g~~y9fmmX6dKK0h<r-   r$   N)
r%   r&   r'   r(   r  r  r  r  r)   r*   r+   s   @r!   rv  rv  7  s     F	""= =r-   rv  c                   ,   a  ] tR tRt o R tR tRtV tR# )Test_fileinput_closeiv  c                    R \         n        \         P                  ! 4        V P                  \         P                  4       R # r1   )rd  re  rR   assertIsNoner4   s   &r!   r  'Test_fileinput_close.test_state_is_Noney  s*      	)**+r-   c                    \        4       pV\        n        \        P                  ! 4        V P	                  VR 4       V P                  \        P                  4       R# rN  )rB  rd  re  rR   rs  r  r  s   & r!   test_state_is_not_None+Test_fileinput_close.test_state_is_not_None  sA     !?#	''':)**+r-   r$   Nr%   r&   r'   r(   r  r  r)   r*   r+   s   @r!   r  r  v  s     ,, ,r-   r  c                   ,   a  ] tR tRt o R tR tRtV tR# )Test_fileinput_nextfilei  c                B   R \         n        V P                  \        4      ;_uu_ 4       p\         P                  ! 4        R R R 4       V P                  RXP                  P                  4       V P                  \         P                  4       R #   + '       g   i     LW; iN)zno active input())	rd  re  r   rz  rx   rr   r|  r   r  r   r  s   & r!   r  *Test_fileinput_nextfile.test_state_is_None  h      	|,,  -/1B1BC)**+ -,   BB	c                   \        4       p\        4       pWP                  R &   V\        n        \        P
                  ! 4       pV P                  VR 4       V P                  W14       V P                  \        P                  V4       R# )rx   N)ry  rB  rK  rd  re  rx   rs  r}  )r   nextfile_retvalr~  retvals   &   r!   r  .Test_fileinput_nextfile.test_state_is_not_None  f    
 !( ?-<z*#	##%''*=f.i&&1r-   r$   Nr  r+   s   @r!   r  r         ,2 2r-   r  c                   ,   a  ] tR tRt o R tR tRtV tR# )Test_fileinput_filenamei  c                B   R \         n        V P                  \        4      ;_uu_ 4       p\         P                  ! 4        R R R 4       V P                  RXP                  P                  4       V P                  \         P                  4       R #   + '       g   i     LW; ir  )	rd  re  r   rz  r?   rr   r|  r   r  r  s   & r!   r  *Test_fileinput_filename.test_state_is_None  r  r  c                   \        4       p\        4       pWP                  R &   V\        n        \        P
                  ! 4       pV P                  VR 4       V P                  W14       V P                  \        P                  V4       R# )r?   N)ry  rB  rK  rd  re  r?   rs  r}  )r   filename_retvalr~  r  s   &   r!   r  .Test_fileinput_filename.test_state_is_not_None  r  r-   r$   Nr  r+   s   @r!   r  r    r  r-   r  c                   ,   a  ] tR tRt o R tR tRtV tR# )Test_fileinput_linenoi  c                B   R \         n        V P                  \        4      ;_uu_ 4       p\         P                  ! 4        R R R 4       V P                  RXP                  P                  4       V P                  \         P                  4       R #   + '       g   i     LW; ir  )	rd  re  r   rz  rs   rr   r|  r   r  r  s   & r!   r  (Test_fileinput_lineno.test_state_is_None  h      	|,, -/1B1BC)**+ -,r  c                   \        4       p\        4       pWP                  R &   V\        n        \        P
                  ! 4       pV P                  VR 4       V P                  W14       V P                  \        P                  V4       R# )rs   N)ry  rB  rK  rd  re  rs   rs  r}  )r   lineno_retvalr~  r  s   &   r!   r  ,Test_fileinput_lineno.test_state_is_not_None  sf    
  ?+8x(#	!!#''(;f,i&&1r-   r$   Nr  r+   s   @r!   r  r    r  r-   r  c                   ,   a  ] tR tRt o R tR tRtV tR# )Test_fileinput_filelinenoi  c                B   R \         n        V P                  \        4      ;_uu_ 4       p\         P                  ! 4        R R R 4       V P                  RXP                  P                  4       V P                  \         P                  4       R #   + '       g   i     LW; ir  )	rd  re  r   rz  rt   rr   r|  r   r  r  s   & r!   r  ,Test_fileinput_filelineno.test_state_is_None  sh      	|,,  " -/1B1BC)**+ -,r  c                   \        4       p\        4       pWP                  R &   V\        n        \        P
                  ! 4       pV P                  VR 4       V P                  W14       V P                  \        P                  V4       R# )rt   N)ry  rB  rK  rd  re  rt   rs  r}  )r   filelineno_retvalr~  r  s   &   r!   r  0Test_fileinput_filelineno.test_state_is_not_None  sg    
 #H ?/@|,#	%%''',?f0i&&1r-   r$   Nr  r+   s   @r!   r  r    r  r-   r  c                   ,   a  ] tR tRt o R tR tRtV tR# )Test_fileinput_filenoi  c                B   R \         n        V P                  \        4      ;_uu_ 4       p\         P                  ! 4        R R R 4       V P                  RXP                  P                  4       V P                  \         P                  4       R #   + '       g   i     LW; ir  )	rd  re  r   rz  r   rr   r|  r   r  r  s   & r!   r  (Test_fileinput_fileno.test_state_is_None  r  r  c                   \        4       p\        4       pWP                  R &   Wn        V\        n        \        P                  ! 4       pV P                  VR 4       V P                  W14       V P                  \        P
                  V4       R# )r   N)	ry  rB  rK  fileno_retvalrd  re  r   rs  r}  )r   r  r~  r  s   &   r!   r  ,Test_fileinput_fileno.test_state_is_not_None  sl    
  ?+8x(!.#	!!#''(;f,i&&1r-   r$   Nr  r+   s   @r!   r  r    s     ,2 2r-   r  c                   ,   a  ] tR tRt o R tR tRtV tR# )Test_fileinput_isfirstlinei  c                B   R \         n        V P                  \        4      ;_uu_ 4       p\         P                  ! 4        R R R 4       V P                  RXP                  P                  4       V P                  \         P                  4       R #   + '       g   i     LW; ir  )	rd  re  r   rz  rv   rr   r|  r   r  r  s   & r!   r  -Test_fileinput_isfirstline.test_state_is_None  sh      	|,,!!# -/1B1BC)**+ -,r  c                   \        4       p\        4       pWP                  R &   V\        n        \        P
                  ! 4       pV P                  VR 4       V P                  W14       V P                  \        P                  V4       R# )rv   N)ry  rB  rK  rd  re  rv   rs  r}  )r   isfirstline_retvalr~  r  s   &   r!   r  1Test_fileinput_isfirstline.test_state_is_not_None  sg    
 $X ?0B}-#	&&(''-@f1i&&1r-   r$   Nr  r+   s   @r!   r  r    r  r-   r  c                   ,   a  ] tR tRt o R tR tRtV tR# )Test_fileinput_isstdini,  c                B   R \         n        V P                  \        4      ;_uu_ 4       p\         P                  ! 4        R R R 4       V P                  RXP                  P                  4       V P                  \         P                  4       R #   + '       g   i     LW; ir  )	rd  re  r   rz  rw   rr   r|  r   r  r  s   & r!   r  )Test_fileinput_isstdin.test_state_is_None/  sh      	|,, -/1B1BC)**+ -,r  c                   \        4       p\        4       pWP                  R &   V\        n        \        P
                  ! 4       pV P                  VR 4       V P                  W14       V P                  \        P                  V4       R# )rw   N)ry  rB  rK  rd  re  rw   rs  r}  )r   isstdin_retvalr~  r  s   &   r!   r  -Test_fileinput_isstdin.test_state_is_not_None9  sf    
   ?,:y)#	""$'')<f-i&&1r-   r$   Nr  r+   s   @r!   r  r  ,  r  r-   r  c                   ,   a  ] tR tRt o R tR tRtV tR# )InvocationRecorderiG  c                    ^ V n         R# )r   N)invocation_countr4   s   &r!   r5   InvocationRecorder.__init__I  s
     !r-   c                p    V ;P                   ^,          un         W3V n        \        P                  ! R4      # )rn  s
   some bytes)r  last_invocationr   r   r   s   &*,r!   r   InvocationRecorder.__call__L  s,    " $~zz-((r-   )r  r  Nr   r+   s   @r!   r  r  G  s     ") )r-   r  c                     a  ] tR tRt o R tR tR t]P                  ! ]	R4      R 4       t
]P                  ! ]	R4      R 4       t]P                  ! ]R4      R	 4       tR
 tR tR tR tR tR tR t]R 4       tRtV tR# )Test_hook_compressediR  c                $    \        4       V n        R # r1   )r  	fake_openr4   s   &r!   rh  Test_hook_compressed.setUpU  s    +-r-   c                *    V P                  R R4       R# )rC   rC  Ndo_test_use_builtin_open_textr4   s   &r!   test_empty_string&Test_hook_compressed.test_empty_stringX  s    **2s3r-   c                *    V P                  R R4       R# abcdrC  Nr  r4   s   &r!   test_no_ext Test_hook_compressed.test_no_ext[      **637r-   zRequires gzip and zlibc                R   \         P                  pV P                  \         n         \        P                  ! R R4      pV\         n        V P                  V P                  P                  ^4       V P                  V P                  P                  R/ 34       R#   T\         n        i ; i)test.gzrC  N)r  rC  )gzipr   r  rd  hook_compressedrr   r  r  r   original_openr   s   &  r!   test_gz_ext_fake%Test_hook_compressed.test_gz_ext_fake^  sy    		NN		&..y#>F%DI88!<77:JB9OP &DI   B B&c                    \         P                  pR  \         n         \        P                  ! RRRR7      pV\         n        V P	                  \        V4      R.4       R#   T\         n        i ; i)c                 .    \         P                  ! R 4      # )s   Ex-binary string)r   r   r   s   &&r!   r   ATest_hook_compressed.test_gz_with_encoding_fake.<locals>.<lambda>m  s    2::6I+Jr-   r  rC  r   r   zEx-binary stringN)r  r   rd  r  rr   rq   r  s   &  r!   test_gz_with_encoding_fake/Test_hook_compressed.test_gz_with_encoding_fakej  sU    		J		&..y#PF%DIf(:';< &DIs   A   A-zRequires bz2c                R   \         P                  pV P                  \         n         \        P                  ! R R4      pV\         n        V P                  V P                  P                  ^4       V P                  V P                  P                  R/ 34       R#   T\         n        i ; i)test.bz2rC  N)r  rC  )bz2BZ2Filer  rd  r  rr   r  r  r  s   &  r!   test_bz2_ext_fake&Test_hook_compressed.test_bz2_ext_faket  sy    nn	(..z3?F'CK88!<77:KR9PQ (CKr  c                *    V P                  R R4       R# )z	abcd.blahr   Ndo_test_use_builtin_open_binaryr4   s   &r!   test_blah_ext"Test_hook_compressed.test_blah_ext  s    ,,[$?r-   c                *    V P                  R R4       R# )zabcd.Gzr   Nr  r4   s   &r!   test_gz_ext_builtin(Test_hook_compressed.test_gz_ext_builtin  s    ,,Y=r-   c                *    V P                  R R4       R# )zabcd.Bz2r   Nr  r4   s   &r!   test_bz2_ext_builtin)Test_hook_compressed.test_bz2_ext_builtin  s    ,,Z>r-   c                *    V P                  R R4       R# )r  r   Nr  r4   s   &r!   test_binary_mode_encoding.Test_hook_compressed.test_binary_mode_encoding  s    ,,VT:r-   c                *    V P                  R R4       R# r  r  r4   s   &r!   test_text_mode_encoding,Test_hook_compressed.test_text_mode_encoding  r  r-   c                ^   V P                  V P                  4      p \        P                  ! W4      pV P                  V4       V P	                  V P                  P
                  ^4       V P	                  V P                  P                  W3RRRR/34       R#   T P                  T4       i ; i)rn  r   Nr   replace_builtin_openr  rd  r  rr   r  r  r   r?   r   r  r   s   &&&  r!   r  4Test_hook_compressed.do_test_use_builtin_open_binary  s    11$..A	5..x>F%%m488!<77#*Zx,NO	Q %%m4   B B,c                ^   V P                  V P                  4      p \        P                  ! W4      pV P                  V4       V P	                  V P                  P
                  ^4       V P	                  V P                  P                  W3RRRR/34       R#   T P                  T4       i ; i)rn  r   localer   Nr  r  s   &&&  r!   r  2Test_hook_compressed.do_test_use_builtin_open_text  s    11$..A	5..x>F%%m488!<77#*Z8T,RS	U %%m4r  c                <    \         P                  pV \         n        V# r1   )builtinsr   )new_open_funcr  s   & r!   r  )Test_hook_compressed.replace_builtin_open  s     %r-   )r  N)r%   r&   r'   r(   rh  r  r  unittest
skipUnlessr  r  r  r  r  r  r   r  r  r	  r  r  staticmethodr  r)   r*   r+   s   @r!   r  r  R  s     .48 78	Q 9	Q 78= 9= n-	R .	R@>?;8	Q	U  r-   r  c                   2   a  ] tR tRt o R tR tR tRtV tR# )Test_hook_encodedi  c                t   \        4       p\        4       p\        P                  ! WR 7      p\        4       p\        P
                  pV\        n         \        4       p\        4       pV! Wg4      pV\        n        V P                  VP                  ^4       VP                  w  rV P                  V	^ ,          V4       V P                  V	^,          V4       V P                  V
P                  R4      V4       V P                  V
P                  R4      V4       V P                  V
4       R#   T\        n        i ; i)r   r   r   N)ry  rd  r   r  r  r   rr   r  r  r}  popru   )r   r   r   r   r  r  r?   r   open_resultr   r   s   &          r!   testTest_hook_encoded.test  s    8''@&(	 !	*xH8D 0K)HM33Q7 00d1gx(d1gt$fjj,h7fjj*F3  *HMs   D* *D7c                  a  \        \        R 4      ;_uu_ 4       pVP                  R4       RRR4       S P                  \        \        4       V 3R lpV! RR.4       S P                  \        4      ;_uu_ 4        V! RR.4       RRR4       V! RR.4       V! R	R
.4       R#   + '       g   i     L; i  + '       g   i     L9; i)r   s   abcNc           	         < \        \        R \        RV R7      R7      ;_uu_ 4       p\        V4      pRRR4       SP	                  XV4       R#   + '       g   i     L$; i)rC  r   r  rf   r   r@   Nr   r   r   rq   rr   )r   expected_linesr   rN   r   s   &&  r!   check,Test_hook_encoded.test_errors.<locals>.check  sQ    c$0$HJ JMORJ UN3J Js   AA	ignoreabcstrictr   u   �abcbackslashreplacez\x80abc)r   r   r   r   r   r   r   r   r    r(  s   f  r!   test_errorsTest_hook_encoded.test_errors  s    &$1GGJ  V,	4 	h 122(UG$ 3i+' :,/   32s   B$;B7$B4	7C	c                r  a  \        \        R 4      ;_uu_ 4       pVP                  R4       RRR4       S P                  \        \        4       V 3R lpV! R. RO4       S P                  \        4      ;_uu_ 4        V! R. RO4       RRR4       R#   + '       g   i     Ln; i  + '       g   i     R# ; i)r   s   A
B
CD+IKw-Nc                    < \        \        V \        R 4      R7      ;_uu_ 4       p\        V4      pRRR4       SP	                  XV4       R#   + '       g   i     L$; i)zutf-7r%  Nr&  )r   r'  r   rN   r   s   &&  r!   r(  +Test_hook_encoded.test_modes.<locals>.check  sJ    d$0$9; ;>@R; UN3; ;s   AA	rC  r   )r   r   r      D€)r   zB
zCr4  )r   r   r   r   r   r   r   r.  s   f  r!   
test_modesTest_hook_encoded.test_modes  s    &$1GG()   	V,	4 	c34z**$:; +*   +**s   B<B%B"	%B6	r$   N)	r%   r&   r'   r(   r!  r/  r5  r)   r*   r+   s   @r!   r  r    s     !00"< <r-   r  c                   &   a  ] tR tRt o R tRtV tR# )MiscTestr   c                <    \         P                  ! V \        4       R # r1   )r   check__all__rd  r4   s   &r!   test_allMiscTest.test_all  s    T9-r-   r$   N)r%   r&   r'   r(   r;  r)   r*   r+   s   @r!   r8  r8    s     . .r-   r8  __main__)2r   r  ry   rn   rd  rH  r  r   r  r  ImportErrorr  r   r   r   r   test.supportr   test.support.os_helperr   r	   r
   r   r   r!  r   r   r   r/   TestCaserW   r   r   rB  rb  rv  r  r  r  r  r  r  r  r  r  r  r  r8  r%   mainr$   r-   r!   <module>rC     s  
 
 	 
 	      ! -   3 8 "  	 	" "HQy("3"3 Qf$ $EY 1 1 ED
-- --^0X%6%6 0*==9 ==~,9 ,&2< 262< 262: 262 > 262: 282!? 262; 26) )W8,, Wr:<)) :<z.x   . zMMO {  
C  Ds"   F F& 	F#"F#&	F32F3