Server : LiteSpeed
System : Linux server51.dnsbootclub.com 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
User : nandedex ( 1060)
PHP Version : 8.1.33
Disable Function : NONE
Directory :  /opt/cppython/lib/python3.8/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]


Current File : //opt/cppython/lib/python3.8/test/__pycache__/test_print.cpython-38.pyc
U

>��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�./opt/cppython/lib/python3.8/test/test_print.py�<lambda>�rcCst|d|i�S)Nrrrrrr
rrcCst|d|i�S)Nr
rrrrr
rrcCst|||d��S)N)r
rrrrrr
rrcCst|d|i�S)Nr	rrrrr
rrcCst|||d��S)N)r	rrrrrr
rrcCst|||d��S)N�r	r
rrrrr
rrcCst||||d��S)N�r	r
rrrrrr
rr))FFF)FFT)FTF)FTT)TFF)TFT)TTF)TTTc@seZdZdd�Zdd�ZdS)�ClassWith__str__cCs
||_dSr��x��selfrrrr
�__init__$szClassWith__str__.__init__cCs|jSrr�rrrr
�__str__'szClassWith__str__.__str__N)�__name__�
__module__�__qualname__rrrrrr
r#src@s0eZdZdZeeefdd�Zdd�Zdd�ZdS)	�	TestPrintz-Test correct operation of the print function.c	CsPt|tk	|tk	|tk	f}t���}|||||�W5QRX|�|��|�dSr)�dispatch�
NotDefinedrZcaptured_stdout�assertEqual�getvalue)r�expectedrr	r
r�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)Nr�r)r%rr r!)r"rr	r
�orrr
r@szTestPrint.test_print.<locals>.x�
r�a
)�azNone
rz1 2
)��z1   2
)r+� r,z1*2
�*)r	z1 s)r+�sr&)r
za
b
)r*�bz1.01)g�?r+rz1*a*1.3+)r+r*g�������?�+za

b
)r)r0z+ +
)�r-r2za
 b
z*
zabc 1
�abcr+�)r)rr�assertRaises�	TypeErrorr�AttributeErrorrr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)Nr&r)�written�flushedrrrr
rjsz5TestPrint.test_print_flush.<locals>.filelike.__init__cSs|j|7_dSr)r9�r�strrrr
�writensz2TestPrint.test_print_flush.<locals>.filelike.writecSs|jd7_dS)Nr+)r:rrrr
�flushqsz2TestPrint.test_print_flush.<locals>.filelike.flushN)rrrrr=r>rrrr
�filelikeisr?r+r&T)rr
r>r,r4F)rr>z123
c@seZdZdd�Zdd�ZdS)z+TestPrint.test_print_flush.<locals>.noflushcSsdSrrr;rrr
r=}sz1TestPrint.test_print_flush.<locals>.noflush.writecSst�dSr)�RuntimeErrorrrrr
r>�sz1TestPrint.test_print_flush.<locals>.noflush.flushN)rrrr=r>rrrr
�noflush|srA)rr r9r:r5r@)rr?�frArrr
�test_print_flushgszTestPrint.test_print_flushN)rrr�__doc__rr%r8rCr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.
    c	Cs8d}|�t��}t|�W5QRX|�dt|j��dS)Nzprint "Hello World"�print("Hello World")�r5�SyntaxError�exec�assertInr<�	exception�rZpython2_print_str�contextrrr
�test_normal_string�sz'TestPy2MigrationHint.test_normal_stringc	Cs8d}|�t��}t|�W5QRX|�dt|j��dS)Nzprint "Hello World",�print("Hello World", end=" ")rGrLrrr
�test_string_with_soft_space�sz0TestPy2MigrationHint.test_string_with_soft_spacec	Cs8d}|�t��}t|�W5QRX|�dt|j��dS)Nzprint  "Hello World", rOrGrLrrr
�%test_string_with_excessive_whitespace�sz:TestPy2MigrationHint.test_string_with_excessive_whitespacec	Cs8d}|�t��}t|�W5QRX|�dt|j��dS)Nz.if 1:
            print "Hello World"
        rFrGrLrrr
�#test_string_with_leading_whitespace�sz8TestPy2MigrationHint.test_string_with_leading_whitespacec	Cs8d}|�t��}t|�W5QRX|�dt|j��dS)Nzprint p;zprint(p)rGrLrrr
�test_string_with_semicolon�sz/TestPy2MigrationHint.test_string_with_semicolonc	Cs8d}|�t��}t|�W5QRX|�dt|j��dS)Nzfor i in s: print izprint(i)rGrLrrr
� test_string_in_loop_on_same_line�sz5TestPy2MigrationHint.test_string_in_loop_on_same_linec	Cs�|�t��}ttj?dfW5QRX|�dt|j��|�t��}td?W5QRX|�dt|j��|�t��}ttj?W5QRX|�	dt|j��|�t��}ttj>W5QRX|�	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)NrVr)rZlhsrrr
�__rrshift__�szhTestPy2MigrationHint.test_stream_redirection_hint_for_py2_migration.<locals>.OverrideRRShift.__rrshift__N)rrrrWrrrr
�OverrideRRShift�srX)r5r6r�sys�stderrrJr<rK�maxZassertNotInr )rrMrXrrr
�.test_stream_redirection_hint_for_py2_migration�s$��zCTestPy2MigrationHint.test_stream_redirection_hint_for_py2_migrationN)rrrrDrNrPrQrRrSrTr\rrrr
rE�srE�__main__)ZunittestrY�ior�testr�objectrrrZTestCaserrEr�mainrrrr
�<module>s$	�ZU

F1le Man4ger