HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //proc/thread-self/root/usr/local/lib/python3.7/test/__pycache__/test_print.cpython-37.opt-2.pyc
B

��g{�	@s�ddlZddlZddlmZddlmZe�Zdd�dd�dd�dd�d	d�d
d�dd�dd�d
�ZGdd�d�Z	Gdd�dej
�ZGdd�dej
�Ze
dkr�e��dS)�N)�StringIO)�supportcCst|�S)N)�print)�args�sep�end�file�r	�+/usr/local/lib/python3.7/test/test_print.py�<lambda>�rcCst|d|i�S)Nr)r)rrrrr	r	r
rrcCst|d|i�S)Nr)r)rrrrr	r	r
rrcCst|||d��S)N)rr)r)rrrrr	r	r
rrcCst|d|i�S)Nr)r)rrrrr	r	r
rrcCst|||d��S)N)rr)r)rrrrr	r	r
rrcCst|||d��S)N)rr)r)rrrrr	r	r
rrcCst||||d��S)N)rrr)r)rrrrr	r	r
rr))FFF)FFT)FTF)FTT)TFF)TFT)TTF)TTTc@seZdZdd�Zdd�ZdS)�ClassWith__str__cCs
||_dS)N)�x)�selfrr	r	r
�__init__$szClassWith__str__.__init__cCs|jS)N)r)rr	r	r
�__str__'szClassWith__str__.__str__N)�__name__�
__module__�__qualname__rrr	r	r	r
r
#sr
c@s,eZdZeeefdd�Zdd�Zdd�ZdS)�	TestPrintc	CsPt|tk	|tk	|tk	f}t���}|||||�WdQRX|�|��|�dS)N)�dispatch�
NotDefinedrZcaptured_stdout�assertEqual�getvalue)r�expectedrrrr�fn�tr	r	r
�check.s
zTestPrint.checkcs<ttf�fdd�	}|dd�|dd�|dd�|d	d
�|dd�|d
d
dd�|dddd�|dddd�|ddddd�|ddddd�|dddd�|dddd�|d d�|d ddd�|d ddd�|d dddd�|d!td�f�|d"td#�d$f��jttdd%d��jttdd%d��jttddd&�dS)'Ncs@�j||||d�t�}�jd||||d���|��|�dS)N)rr�)rrr)rrrr)rrrr�o)rr	r
r@szTestPrint.test_print.<locals>.x�
r	za
)�azNone
)Nz1 2
)��z1   2
)r"� r#z1*2
�*)rz1 s)r"�sr)rza
b
)r!�bz1.01)g�?r")rrz1*a*1.3+)r"r!g�������?�+za

b
)za
r'z+ +
)�r$r)za
 b
z*
zabc 1
�abcr"�)r)rr
�assertRaises�	TypeErrorr�AttributeError)rrr	)rr
�
test_print?s,





zTestPrint.test_printcCs�Gdd�d�}|�}td|ddd�td|ddd�td|d	d
�|�|jd�|�|jd�Gdd
�d
�}|jttd|�dd
�dS)Nc@s$eZdZdd�Zdd�Zdd�ZdS)z,TestPrint.test_print_flush.<locals>.filelikecSsd|_d|_dS)Nrr)�written�flushed)rr	r	r
rjsz5TestPrint.test_print_flush.<locals>.filelike.__init__cSs|j|7_dS)N)r0)r�strr	r	r
�writensz2TestPrint.test_print_flush.<locals>.filelike.writecSs|jd7_dS)Nr")r1)rr	r	r
�flushqsz2TestPrint.test_print_flush.<locals>.filelike.flushN)rrrrr3r4r	r	r	r
�filelikeisr5r"rT)rrr4r#r+F)rr4z123
c@seZdZdd�Zdd�ZdS)z+TestPrint.test_print_flush.<locals>.noflushcSsdS)Nr	)rr2r	r	r
r3}sz1TestPrint.test_print_flush.<locals>.noflush.writecSst�dS)N)�RuntimeError)rr	r	r
r4�sz1TestPrint.test_print_flush.<locals>.noflush.flushN)rrrr3r4r	r	r	r
�noflush|sr7)rrr0r1r,r6)rr5�fr7r	r	r
�test_print_flushgszTestPrint.test_print_flushN)rrrrrr/r9r	r	r	r
r+s(rc@sDeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�TestPy2MigrationHintc	Cs8d}|�t��}t|�WdQRX|�dt|j��dS)Nzprint "Hello World"zprint("Hello World"))r,�SyntaxError�exec�assertInr2�	exception)r�python2_print_str�contextr	r	r
�test_normal_string�sz'TestPy2MigrationHint.test_normal_stringc	Cs8d}|�t��}t|�WdQRX|�dt|j��dS)Nzprint "Hello World",zprint("Hello World", end=" "))r,r;r<r=r2r>)rr?r@r	r	r
�test_string_with_soft_space�sz0TestPy2MigrationHint.test_string_with_soft_spacec	Cs8d}|�t��}t|�WdQRX|�dt|j��dS)Nzprint  "Hello World", zprint("Hello World", end=" "))r,r;r<r=r2r>)rr?r@r	r	r
�%test_string_with_excessive_whitespace�sz:TestPy2MigrationHint.test_string_with_excessive_whitespacec	Cs8d}|�t��}t|�WdQRX|�dt|j��dS)Nz.if 1:
            print "Hello World"
        zprint("Hello World"))r,r;r<r=r2r>)rr?r@r	r	r
�#test_string_with_leading_whitespace�sz8TestPy2MigrationHint.test_string_with_leading_whitespacec	Cs8d}|�t��}t|�WdQRX|�dt|j��dS)Nzprint p;zprint(p))r,r;r<r=r2r>)rr?r@r	r	r
�test_string_with_semicolon�sz/TestPy2MigrationHint.test_string_with_semicolonc	Cs8d}|�t��}t|�WdQRX|�dt|j��dS)Nzfor i in s: print izprint(i))r,r;r<r=r2r>)rr?r@r	r	r
� test_string_in_loop_on_same_line�sz5TestPy2MigrationHint.test_string_in_loop_on_same_linec	Cs�|�t��}ttj?dfWdQRX|�dt|j��|�t��}td?WdQRX|�dt|j��|�t��}ttj?WdQRX|�	dt|j��|�t��}ttj>WdQRX|�	dt|j��Gdd�d�}|�
t|�?d�dS)N�messagez6Did you mean "print(<message>, file=<output_stream>)"?�*z
Did you mean zDid you meanc@seZdZdd�ZdS)z\TestPy2MigrationHint.test_stream_redirection_hint_for_py2_migration.<locals>.OverrideRRShiftcSsdS)NrHr	)rZlhsr	r	r
�__rrshift__�szhTestPy2MigrationHint.test_stream_redirection_hint_for_py2_migration.<locals>.OverrideRRShift.__rrshift__N)rrrrIr	r	r	r
�OverrideRRShift�srJ)r,r-r�sys�stderrr=r2r>�maxZassertNotInr)rr@rJr	r	r
�.test_stream_redirection_hint_for_py2_migration�s zCTestPy2MigrationHint.test_stream_redirection_hint_for_py2_migrationN)
rrrrArBrCrDrErFrNr	r	r	r
r:�sr:�__main__)ZunittestrK�iorZtestr�objectrrr
ZTestCaserr:r�mainr	r	r	r
�<module>s"	ZU