HEX
Server: Apache
System: Linux opal14.opalstack.com 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64
User: curbgloabal_opal (1234)
PHP: 8.1.29
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib64/python3.6/test/__pycache__/test_print.cpython-36.pyc
3


 \{�@s�ddlZddlZddlmZddlmZe�Zddd�ddd�dd	d�dd
d�ddd�ddd�dd
d�ddd�iZGdd�d�Z	Gdd�dej
�ZGdd�dej
�Ze
dkr�ej�dS)�N)�StringIO)�supportFcCst|�S)N)�print)�args�sep�end�file�r	�"/usr/lib64/python3.6/test_print.py�<lambda>srTcCst|d|i�S)Nr)r)rrrrr	r	r
rscCst|d|i�S)Nr)r)rrrrr	r	r
rscCst|||d��S)N)rr)r)rrrrr	r	r
rscCst|d|i�S)Nr)r)rrrrr	r	r
rscCst|||d��S)N)rr)r)rrrrr	r	r
rscCst|||d��S)N)rr)r)rrrrr	r	r
rscCst||||d��S)N)rrr)r)rrrrr	r	r
rsc@seZdZdd�Zdd�ZdS)�ClassWith__str__cCs
||_dS)N)�x)�selfr
r	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@s0eZdZdZeeefdd�Zdd�Zdd�ZdS)	�	TestPrintz-Test correct operation of the print function.cCsPt|tk	|tk	|tk	f}tj��}|||||�WdQRX|j|j�|�dS)N)�dispatch�
NotDefinedrZcaptured_stdout�assertEqual�getvalue)r�expectedrrrr�fn�tr	r	r
�check.s
zTestPrint.checkcs<ttf�fdd�	}|df�|dd$�|dd%�|dd&�|d
d'�|dd(d
d�|dd)dd�|dd*dd�|dd+ddd�|dd,d
dd�|dd-dd�|dd.dd�|dd/�|dd0dd�|dd1dd�|dd2ddd�|dtd
�f�|d td!�df��jttdd"d��jttdd"d��jttddd#�dS)3Ncs@�j||||d�t�}�jd||||d��j|j�|�dS)N)rr�)rrr)rrrr)rrrr�o)rr	r
r
@szTestPrint.test_print.<locals>.x�
�a
�azNone
z1 2
��z1   2
� z1*2
�*)rz1 s�sr)rza
b
�bz1.01��?)rrz1*a*1.3+��������?�+za

b
z+ +
�za
 b
z*
zabc 1
�abc�)r)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')r r')r r')r r')rr�assertRaises�	TypeErrorr�AttributeError)rr
r	)rr
�
test_print?s,





zTestPrint.test_printcCs�Gdd�d�}|�}td|ddd�td|ddd�td|d	d
�|j|jd�|j|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)r2)r�strr	r	r
�writensz2TestPrint.test_print_flush.<locals>.filelike.writecSs|jd7_dS)Nr")r3)rr	r	r
�flushqsz2TestPrint.test_print_flush.<locals>.filelike.flushN)rrrrr5r6r	r	r	r
�filelikeisr7r"rT)rrr6r#r-F)rr6z123
c@seZdZdd�Zdd�ZdS)z+TestPrint.test_print_flush.<locals>.noflushcSsdS)Nr	)rr4r	r	r
r5}sz1TestPrint.test_print_flush.<locals>.noflush.writecSst�dS)N)�RuntimeError)rr	r	r
r6�sz1TestPrint.test_print_flush.<locals>.noflush.flushN)rrrr5r6r	r	r	r
�noflush|sr9)rrr2r3r.r8)rr7�fr9r	r	r
�test_print_flushgszTestPrint.test_print_flushN)rrr�__doc__rrr1r;r	r	r	r
r+s(rc@sHeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dS)�TestPy2MigrationHintzwTest that correct hint is produced analogous to Python3 syntax,
    if print statement is executed as in Python 2.
    cCs8d}|jt��}t|�WdQRX|jdt|j��dS)Nzprint "Hello World"zprint("Hello World"))r.�SyntaxError�exec�assertInr4�	exception)r�python2_print_str�contextr	r	r
�test_normal_string�sz'TestPy2MigrationHint.test_normal_stringcCs8d}|jt��}t|�WdQRX|jdt|j��dS)Nzprint "Hello World",zprint("Hello World", end=" "))r.r>r?r@r4rA)rrBrCr	r	r
�test_string_with_soft_space�sz0TestPy2MigrationHint.test_string_with_soft_spacecCs8d}|jt��}t|�WdQRX|jdt|j��dS)Nzprint  "Hello World", zprint("Hello World", end=" "))r.r>r?r@r4rA)rrBrCr	r	r
�%test_string_with_excessive_whitespace�sz:TestPy2MigrationHint.test_string_with_excessive_whitespacecCs8d}|jt��}t|�WdQRX|jdt|j��dS)Nz.if 1:
            print "Hello World"
        zprint("Hello World"))r.r>r?r@r4rA)rrBrCr	r	r
�#test_string_with_leading_whitespace�sz8TestPy2MigrationHint.test_string_with_leading_whitespacecCs8d}|jt��}t|�WdQRX|jdt|j��dS)Nzprint p;zprint(p))r.r>r?r@r4rA)rrBrCr	r	r
�test_string_with_semicolon�sz/TestPy2MigrationHint.test_string_with_semicoloncCs8d}|jt��}t|�WdQRX|jdt|j��dS)Nzfor i in s: print izprint(i))r.r>r?r@r4rA)rrBrCr	r	r
� test_string_in_loop_on_same_line�sz5TestPy2MigrationHint.test_string_in_loop_on_same_linec Cs�|jt��}ttj?dfWdQRX|jdt|j��|jt��}td?WdQRX|jdt|j��|jt��}ttj?WdQRX|j	dt|j��|jt��}ttj>WdQRX|j	dt|j��Gdd�d�}|j
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)NrKr	)rZlhsr	r	r
�__rrshift__�szhTestPy2MigrationHint.test_stream_redirection_hint_for_py2_migration.<locals>.OverrideRRShift.__rrshift__N)rrrrLr	r	r	r
�OverrideRRShift�srM)r.r/r�sys�stderrr@r4rA�maxZassertNotInr)rrCrMr	r	r
�.test_stream_redirection_hint_for_py2_migration�s zCTestPy2MigrationHint.test_stream_redirection_hint_for_py2_migrationN)rrrr<rDrErFrGrHrIrQr	r	r	r
r=�sr=�__main__)FFF)FFT)FTF)FTT)TFF)TFT)TTF)TTT)ZunittestrN�iorZtestr�objectrrrZTestCaserr=r�mainr	r	r	r
�<module>s2
ZU