
    0hh6               	           S SK r S SKrS SKJr  S SKJr  \" 5       rS S S S S S	 S
 S S.r " S S5      r	 " S S\ R                  5      r " S S\ R                  5      r\S:X  a  \ R                  " 5         gg)    N)StringIO)supportc                     [        U 6 $ Nprintargssependfiles       8/opt/python-3.13.8/usr/lib/python3.13/test/test_print.py<lambda>r      s    UD\    c                     [        U SU06$ )Nr   r   r	   s       r   r   r      s    Ut%<%<r   c                     [        U SU06$ )Nr   r   r	   s       r   r   r          UT%:s%:r   c                     [        XUS.6$ )N)r   r   r   r	   s       r   r   r          U%Er   c                     [        U SU06$ )Nr   r   r	   s       r   r   r      r   r   c                     [        XUS.6$ )N)r   r   r   r	   s       r   r   r      r   r   c                     [        XUS.6$ )Nr   r   r   r	   s       r   r   r      s    Ud%Cr   c                     [        XX#S.6$ )Nr   r   r   r   r	   s       r   r   r      s    U%Nr   ))FFF)FFT)FTF)FTT)TFF)TFT)TTF)TTTc                        \ rS rSrS rS rSrg)ClassWith__str__#   c                     Xl         g r   xselfr!   s     r   __init__ClassWith__str__.__init__$   s    r   c                     U R                   $ r   r    r#   s    r   __str__ClassWith__str__.__str__'   s    vvr   r    N)__name__
__module____qualname____firstlineno__r$   r(   __static_attributes__ r   r   r   r   #   s    r   r   c                   6    \ rS rSr\\\4S jrS rS rS rSr	g)	TestPrint+   c                     [         U[        LU[        LU[        L4   n[        R                  " 5        nU" X#XE5        S S S 5        U R	                  WR                  5       U5        g ! , (       d  f       N/= fr   )dispatch
NotDefinedr   captured_stdoutassertEqualgetvalue)r#   expectedr
   r   r   r   fnts           r   checkTestPrint.check.   sj     s*,*,:-/ 0 $$&!t#$ ' 	x0 '&s   
A''
A5c                 &  ^  [         [         4U 4S jjnU" SS5        U" SS5        U" SS5        U" SS	5        U" S
S5        U" SS	SS9  U" SSSS9  U" SSSS9  U" SSSSS9  U" SSSSS9  U" SSSS9  U" SSSS9  U" SS5        U" SSS S9  U" SSS S9  U" SSS S S9  U" S [        S5      45        U" S![        S"5      S#45        T R                  [        [        SS$S9  T R                  [        [        SS$S9  T R                  [
        [        SSS%9  g )&Nc                    > TR                  XX#S9  [        5       nTR                  SXX4S9  TR                  UR                  5       U 5        g )Nr    r   )r<   r   r7   r8   )r9   r
   r   r   or#   s        r   r!   TestPrint.test_print.<locals>.x@   sH     JJx3J8 
AJJr4cJ: QZZ\84r   
r/   a
)azNone
r   z1 2
)      z1   2
)rF    rG   z1*2
*)r   z1 s)rF   sr@   )r   za
b
)rE   bz1.01)g      ?rF   r   z1*a*1.3+)rF   rE   g?+za

b
)rD   rK   z + + 
) rH   rM   za
 b
z*
zabc 1
abcrF      )r   )r5   r   assertRaises	TypeErrorr   AttributeErrorr"   s   ` r   
test_printTestPrint.test_print?   s8   ",* 	5 	
$	%	(G	'6	)[!	'6s#	%r"	(JD)	&(+	*m#6	*l-	+(c2	)\"	)\t,	)\t,	)\t6	%"3')*	)&u-q12 	)UBA6)UBA6.%"=r   c                 0    " S S5      nU" 5       n[        SUSSS9  [        SUSSS9  [        SUS	S
9  U R                  UR                  S5        U R                  UR                  S5         " S S5      nU R	                  [
        [         SU" 5       SS
9  g )Nc                   &    \ rS rSrS rS rS rSrg),TestPrint.test_print_flush.<locals>.filelikei   c                      SU l         SU l        g )Nr@   r   )writtenflushedr'   s    r   r$   5TestPrint.test_print_flush.<locals>.filelike.__init__j   s    ! r   c                 .    U =R                   U-  sl         g r   )rZ   r#   strs     r   write2TestPrint.test_print_flush.<locals>.filelike.writen   s    #r   c                 .    U =R                   S-  sl         g )NrF   )r[   r'   s    r   flush2TestPrint.test_print_flush.<locals>.filelike.flushq   s    !r   )r[   rZ   N)r*   r+   r,   r-   r$   r`   rc   r.   r/   r   r   filelikerW   i   s    !$"r   re   rF   r@   T)r   r   rc   rG   rO   F)r   rc   z123
c                        \ rS rSrS rS rSrg)+TestPrint.test_print_flush.<locals>.noflush|   c                     g r   r/   r^   s     r   r`   1TestPrint.test_print_flush.<locals>.noflush.write}   s    r   c                     [         er   )RuntimeErrorr'   s    r   rc   1TestPrint.test_print_flush.<locals>.noflush.flush   s    ""r   r/   N)r*   r+   r,   r-   r`   rc   r.   r/   r   r   noflushrg   |   s    #r   rn   )r   r7   rZ   r[   rP   rl   )r#   re   frn   s       r   test_print_flushTestPrint.test_print_flushg   s    		" 		" JaaRt,aaRt,aau%G,A&	# 	# 	,qwyMr   c                      " S S5      n[         R                  " [        SS 5         [        5       [        l        [        U" 5       5        S S S 5        g ! , (       d  f       g = f)Nc                       \ rS rSrS rSrg)"TestPrint.test_gh130163.<locals>.X   c                 T    [        5       [        l        [        R                  " 5         g)Nfoo)r   sysstdoutr   
gc_collectr'   s    r   r(   *TestPrint.test_gh130163.<locals>.X.__str__   s    %Z
""$r   r/   N)r*   r+   r,   r-   r(   r.   r/   r   r   Xrt      s    r   r|   ry   )r   	swap_attrrx   r   ry   r   )r#   r|   s     r   test_gh130163TestPrint.test_gh130163   s>    	 	 sHd3!CJ!#J 433s   $A
A"r/   N)
r*   r+   r,   r-   r5   r<   rS   rp   r~   r.   r/   r   r   r1   r1   +   s!     *:1"&>PN:	r   r1   c                   >    \ rS rSrS rS rS rS rS rS r	S r
S	rg
)TestPy2MigrationHint   c                     SnU R                  [        5       n[        U5        S S S 5        U R                  S[	        WR
                  5      5        g ! , (       d  f       N4= f)Nzprint "Hello World"?Missing parentheses in call to 'print'. Did you mean print(...)rP   SyntaxErrorexecassertInr_   	exceptionr#   python2_print_strcontexts      r   test_normal_string'TestPy2MigrationHint.test_normal_string   N    1{+w"# , 	WG%%&	( ,+   A
A c                     SnU R                  [        5       n[        U5        S S S 5        U R                  S[	        WR
                  5      5        g ! , (       d  f       N4= f)Nzprint "Hello World",r   r   r   s      r   test_string_with_soft_space0TestPy2MigrationHint.test_string_with_soft_space   sN    2{+w"# , 	WG%%&	( ,+r   c                     SnU R                  [        5       n[        U5        S S S 5        U R                  S[	        WR
                  5      5        g ! , (       d  f       N4= f)Nzprint  "Hello World", r   r   r   s      r   %test_string_with_excessive_whitespace:TestPy2MigrationHint.test_string_with_excessive_whitespace   sN    4{+w"# , 	WG%%&	( ,+r   c                     SnU R                  [        5       n[        U5        S S S 5        U R                  S[	        WR
                  5      5        g ! , (       d  f       N4= f)Nz.if 1:
            print "Hello World"
        r   r   r   s      r   #test_string_with_leading_whitespace8TestPy2MigrationHint.test_string_with_leading_whitespace   sR     {+w"# , 	WG%%&	( ,+r   c                     SnU R                  [        5       n[        U5        S S S 5        U R                  S[	        WR
                  5      5        g ! , (       d  f       N4= f)Nzprint p;r   r   r   s      r   test_string_with_semicolon/TestPy2MigrationHint.test_string_with_semicolon   sN    &{+w"# , 	WG%%&	( ,+r   c                     SnU R                  [        5       n[        U5        S S S 5        U R                  S[	        WR
                  5      5        g ! , (       d  f       N4= f)Nzfor i in s: print ir   r   r   s      r    test_string_in_loop_on_same_line5TestPy2MigrationHint.test_string_in_loop_on_same_line   r   r   c                    U R                  [        5       n[        [        R                  -	  S4  S S S 5        U R                  S[        WR                  5      5        U R                  [        5       n[        S-	    S S S 5        U R                  S[        UR                  5      5        U R                  [        5       n[        [        R                  -	    S S S 5        U R                  S[        UR                  5      5        U R                  [        5       n[        [        R                  -    S S S 5        U R                  S[        UR                  5      5         " S S5      nU R                  [        U" 5       -	  S5        g ! , (       d  f       GN]= f! , (       d  f       GN#= f! , (       d  f       N= f! , (       d  f       N= f)Nmessagez6Did you mean "print(<message>, file=<output_stream>)"?*   zDid you mean zDid you meanc                       \ rS rSrS rSrg)\TestPy2MigrationHint.test_stream_redirection_hint_for_py2_migration.<locals>.OverrideRRShift   c                     g)Nr   r/   )r#   lhss     r   __rrshift__hTestPy2MigrationHint.test_stream_redirection_hint_for_py2_migration.<locals>.OverrideRRShift.__rrshift__   s    r   r/   N)r*   r+   r,   r-   r   r.   r/   r   r   OverrideRRShiftr      s    r   r   )rP   rQ   r   rx   stderrr   r_   r   maxassertNotInr7   )r#   r   r   s      r   .test_stream_redirection_hint_for_py2_migrationCTestPy2MigrationHint.test_stream_redirection_hint_for_py2_migration   sJ   y)WSZZ* * *+.w/@/@+A	C
 y)WRK * *+.w/@/@+A	C y)W3:: *#g.?.?*@A y)WSZZ *W->->)?@	 	 	/"33R87 *) *) *)
 *)s/   F2
F>F*F;
F
F'*
F8;
G	r/   N)r*   r+   r,   r-   r   r   r   r   r   r   r   r.   r/   r   r   r   r      s%    
((((((9r   r   __main__)unittestrx   ior   testr   objectr5   r4   r   TestCaser1   r   r*   mainr/   r   r   <module>r      s     
  X
 	2<:E:ECN!* b!! bJW98,, W9v zMMO r   