Your IP : 52.15.190.187


Current Path : /opt/alt/python36/lib64/python3.6/idlelib/idle_test/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/idlelib/idle_test/__pycache__/test_run.cpython-36.pyc

3

� f�$�@s�dZddlmZddlZddlmZddlmZddlZGdd�dej�Z	Gdd	�d	e
�ZGd
d�d�ZGdd
�d
ej�Z
Gdd�dej�Zedkr�ejdd�dS)zTest run, coverage 42%.�)�runN)�mock)�captured_stderrc@seZdZdd�ZdS)�RunTestcCs�Gdd�dt�}|d�}|d�}y
||�Wnp|k
r�y|�WnR|k
r�t��2}tjjtd��}dd�|_tj�WdQRXWdQRXYnXYnX|j�j	�j
�}|jdt|��|j
d	|d
�|j
d|d�dS)
Nc@seZdZdd�ZdS)zDRunTest.test_print_exception_unhashable.<locals>.UnhashableExceptioncSsdS)NT�)�self�otherrr�?/opt/alt/python36/lib64/python3.6/idlelib/idle_test/test_run.py�__eq__szKRunTest.test_print_exception_unhashable.<locals>.UnhashableException.__eq__N)�__name__�
__module__�__qualname__r
rrrr	�UnhashableException
sr�ex1�ex2Zcleanup_tracebackcSs|S)Nr)�t�errr	�<lambda>sz9RunTest.test_print_exception_unhashable.<locals>.<lambda>�zUnhashableException: ex2�zUnhashableException: ex1�
)�	ExceptionrrZpatch�objectrZside_effect�print_exception�getvalue�strip�
splitlines�assertEqual�lenZassertIn)rrrr�outputZct�tbrrr	�test_print_exception_unhashables$

(z'RunTest.test_print_exception_unhashableN)rrr
r!rrrr	r
src@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�ScCsdt|�jS)Nz%s:str)�typer)rrrr	�__str__(sz	S.__str__cCsdt|�jS)Nz
%s:unicode)r#r)rrrr	�__unicode__*sz
S.__unicode__cCsdS)Nrr)rrrr	�__len__,sz	S.__len__cCstd�S)N�abc)�iter)rrrr	�__iter__.sz
S.__iter__cGsdt|�jS)Nz%s:item)r#r)r�argsrrr	�__getitem__0sz
S.__getitem__cGsdt|�jS)Nz%s:slice)r#r)rr*rrr	�__getslice__2szS.__getslice__N)	rrr
r$r%r&r)r+r,rrrr	r"'sr"c@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�	MockShellcCs|j�dS)N)�reset)rrrr	�__init__7szMockShell.__init__cGs|jj|�dS)N)�written�append)rr*rrr	�write9szMockShell.writecCs
|jj�S)N)�lines�pop)rrrr	�readline;szMockShell.readlinecCsdS)Nr)rrrr	�close=szMockShell.closecCs
g|_dS)N)r0)rrrr	r.?szMockShell.resetcCst|�ddd�|_dS)N����)�listr3)rr3rrr	�pushAszMockShell.pushN)	rrr
r/r2r5r6r.r:rrrr	r-6sr-c@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�PseudeInputFilesTestcCs�t�}tj|dd�}|j|tj�|j|jd�|j|j	�|j|j
�|j|jd�|j|j
�|j|j��|j|j��|j|j��|j|j��dS)N�stdinzutf-8z<stdin>)r-r�PseudoInputFile�assertIsInstance�io�
TextIOBaser�encoding�assertIsNone�errors�newlines�name�assertFalse�closed�
assertTrue�isatty�readable�writable�seekable)r�shell�frrr	�	test_miscGszPseudeInputFilesTest.test_misccCsft�}tj|dd�}|jt|j�|jt|j�|jt|jd�|jt|jd�|jt|j	dg�dS)Nr<zutf-8r�x)
r-rr=�assertRaises�OSError�fileno�tell�seekr2�
writelines)rrMrNrrr	�test_unsupportedUsz%PseudeInputFilesTest.test_unsupportedcCst�}tj|dd�}|jdddg�|j|j�d�|jdddg�|j|jd�d�|jdddg�|j|jd�d�|jddddg�|j|jd	�d
�|j|jd�d�|j|jd
�d�|jddg�|j|jd�d�|jt|jd�|jt|jd�|jt|jdd�dS)Nr<zutf-8zone
ztwo
�zone
two
r7zthree
��onrze
trz	wo
three
rg�?�1r8)r-rr=r:r�readrQ�	TypeError)rrMrNrrr	�	test_read^s"zPseudeInputFilesTest.test_readcCsdt�}tj|dd�}|jddddg�|j|j�d�|j|jd�d�|j|jd�d�|jdg�|j|j�d�|j|j�d�|jd	d
dg�|j|j�d	�|j|j�d
�|jdddg�|j|jd�d
�|j|jd�d�|j|jd�d�|j|jd�d�|jddg�|j|jd�d�|jt|jd�|jt|jd�|jt|jdd�dS)Nr<zutf-8zone
ztwo
zthree
zfour
r7zone
two
Zone�twoZthreerYrZr�
rrrXg�?r[r8)	r-rr=r:rr5rQr]�	readlines)rrMrNrrr	�
test_readliners,z"PseudeInputFilesTest.test_readlinecCs:t�}tj|dd�}|jdddg�|j|j�ddg�|jdddg�|j|jd�ddg�|jdddg�|j|jd�ddg�|jdddg�|j|jd�ddg�|jdddg�|j|jd�dg�|jdddg�|j|jd	�ddg�|jdddg�|jt|jd
�|jt|jd�|jt|jdd�dS)
Nr<zutf-8zone
ztwo
rXr7rr�g�?r[r8)r-rr=r:rrarQr])rrMrNrrr	�test_readlines�s$z#PseudeInputFilesTest.test_readlinescCsxt�}tj|dd�}|jdddg�|j|j�|j|j�d�|j�|j|j�|j|j�d�|j	t
|jd�dS)Nr<zutf-8zone
ztwo
rXr7)r-rr=r:rFrGrr5r6rQr])rrMrNrrr	�
test_close�szPseudeInputFilesTest.test_closeN)	rrr
rOrWr^rbrdrerrrr	r;Es	r;c@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�PseudeOutputFilesTestcCs�t�}tj|dd�}|j|tj�|j|jd�|j|j	�|j|j
�|j|jd�|j|j
�|j|j��|j|j��|j|j��|j|j��dS)N�stdoutzutf-8z<stdout>)r-r�PseudoOutputFiler>r?r@rrArBrCrDrErFrGrHrIrJrKrL)rrMrNrrr	rO�szPseudeOutputFilesTest.test_misccCsdt�}tj|dd�}|jt|j�|jt|j�|jt|jd�|jt|jd�|jt|j	d�dS)Nrgzutf-8r)
r-rrhrQrRrSrTrUr\r5)rrMrNrrr	rW�sz&PseudeOutputFilesTest.test_unsupportedcCst�}tj|dd�}|jd�|j|jd	g�|j�|jd�|j|jd
g�|j�|jtd��|j|jdg�|jt|jdd�t	�|j�|j
t|j�|j|jg�|j
t|jd�|j
t|jd�|j|jg�|j
t|jdd�|j|jg�dS)Nrgzutf-8�test�tèstrstest�{Zspam)rirg)rjrg)rjrg)r-rrhr2rr0r.r"r#�strrQr])rrMrNrrr	�
test_write�s&

z PseudeOutputFilesTest.test_writecCsVt�}tj|dd�}|jg�|j|jg�|j�|jddg�|j|jddg�|j�|jddg�|j|jd
dg�|j�|jtd�g�|j|jdg�|jt|jdd�t	�|j�|j
t|j�|j|jg�|j
t|jd	�|j|jg�|j
t|jd
g�|j
t|jd	g�|j|jg�|j
t|jgg�|j|jg�dS)Nrgzutf-8�one
r_�onè
�twò�tèstrrkstest)rnrg)r_rg)rorg)rprg)rqrg)r-rrhrVrr0r.r"r#rlrQr])rrMrNrrr	�test_writelines�s4


z%PseudeOutputFilesTest.test_writelinescCszt�}tj|dd�}|j|j�|jd�|j�|j|j�|jt	|jd�|j
|jdg�|j�|jt|jd�dS)Nrgzutf-8rirPr7)rirg)
r-rrhrFrGr2r6rHrQ�
ValueErrorrr0r])rrMrNrrr	re�s
z PseudeOutputFilesTest.test_closeN)rrr
rOrWrmrrrerrrr	rf�s
	rf�__main__rY)�	verbosity)�__doc__ZidlelibrZunittestrZtest.supportrr?ZTestCaserrlr"r-r;rfr�mainrrrr	�<module>sg[

?>