Your IP : 3.137.200.56


Current Path : /opt/alt/python34/lib64/python3.4/idlelib/idle_test/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/idlelib/idle_test/__pycache__/test_io.cpython-34.pyc

�
e f� �@s�ddlZddlZddlmZmZGdd�de�ZGdd�d�ZGdd�dej�Z	Gd	d
�d
ej�Z
edkr�ej�ndS)�N)�PseudoInputFile�PseudoOutputFilec@sXeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�ScCsdt|�jS)Nz%s:str)�type�__name__)�self�r�>/opt/alt/python34/lib64/python3.4/idlelib/idle_test/test_io.py�__str__sz	S.__str__cCsdt|�jS)Nz
%s:unicode)rr)rrrr	�__unicode__	sz
S.__unicode__cCsdS)N�r)rrrr	�__len__sz	S.__len__cCs
td�S)N�abc)�iter)rrrr	�__iter__
sz
S.__iter__cGsdt|�jS)Nz%s:item)rr)r�argsrrr	�__getitem__sz
S.__getitem__cGsdt|�jS)Nz%s:slice)rr)rrrrr	�__getslice__szS.__getslice__N)	r�
__module__�__qualname__r
rr
rrrrrrr	rsrc@sXeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�	MockShellcCs|j�dS)N)�reset)rrrr	�__init__szMockShell.__init__cGs|jj|�dS)N)�written�append)rrrrr	�writeszMockShell.writecCs
|jj�S)N)�lines�pop)rrrr	�readlineszMockShell.readlinecCsdS)Nr)rrrr	�closeszMockShell.closecCs
g|_dS)N)r)rrrr	r!szMockShell.resetcCs t|�ddd�|_dS)N����)�listr)rrrrr	�push$szMockShell.pushN)	rrrrrrrrr#rrrr	rsrc@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�PseudeOutputFilesTestcCs�t�}t|dd�}|j|tj�|j|jd�|j|j�|j|j	�|j|j
d�|j|j�|j
|j��|j|j��|j
|j��|j|j��dS)N�stdoutzutf-8z<stdout>)rr�assertIsInstance�io�
TextIOBase�assertEqual�encoding�assertIsNone�errors�newlines�name�assertFalse�closed�
assertTrue�isatty�readable�writable�seekable)r�shell�frrr	�	test_misc)s	zPseudeOutputFilesTest.test_misccCs�t�}t|dd�}|jt|j�|jt|j�|jt|jd�|jt|jd�|jt|jd�dS)Nr%zutf-8r)	rr�assertRaises�OSError�fileno�tell�seek�readr)rr6r7rrr	�test_unsupported7s	z&PseudeOutputFilesTest.test_unsupportedcCs^t�}t|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)Nr%zutf-8�test�tèstrstest�{Zspam)r@�stdout)rArC)rArC)rrrr)rrrr�strr9�	TypeError)rr6r7rrr	�
test_write@s&	



!
z PseudeOutputFilesTest.test_writecCs�t�}t|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)Nr%zutf-8�one
�two�onè
�twò�tèstrrBstest)rG�stdout)rHrL)rIrL)rJrL)rKrL)rr�
writelinesr)rrrrrDr9rE)rr6r7rrr	�test_writelinesWs4	





!
z%PseudeOutputFilesTest.test_writelinescCs�t�}t|dd�}|j|j�|jd�|j�|j|j�|jt|jd�|j	|j
dg�|j�|jt|jd�dS)Nr%zutf-8r@�xr )ztestzstdout)rrr/r0rrr1r9�
ValueErrorr)rrE)rr6r7rrr	�
test_closeus	


z PseudeOutputFilesTest.test_closeN)rrrr8r?rFrNrQrrrr	r$(s
	r$c@sXeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�PseudeInputFilesTestcCs�t�}t|dd�}|j|tj�|j|jd�|j|j�|j|j	�|j|j
d�|j|j�|j
|j��|j
|j��|j|j��|j|j��dS)N�stdinzutf-8z<stdin>)rrr&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5)rr6r7rrr	r8�s	zPseudeInputFilesTest.test_misccCs�t�}t|dd�}|jt|j�|jt|j�|jt|jd�|jt|jd�|jt|jdg�dS)NrSzutf-8rrO)	rrr9r:r;r<r=rrM)rr6r7rrr	r?�s	z%PseudeInputFilesTest.test_unsupportedcCs~t�}t|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)NrSzutf-8zone
ztwo
�zone
two
r zthree
��onrze
t�
z	wo
three
rg�?�1r!)rrr#r)r>r9rE)rr6r7rrr	�	test_read�s"	zPseudeInputFilesTest.test_readcCs�t�}t|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)NrSzutf-8zone
ztwo
zthree
zfour
r zone
two
ZonerHZthreerUrV�e�
rWrrTg�?rXr!)rrr#r)rr9rE�	readlines)rr6r7rrr	�
test_readline�s,	z"PseudeInputFilesTest.test_readlinecCs�t�}t|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)
NrSzutf-8zone
ztwo
rTr rr�g�?rXr!)rrr#r)r\r9rE)rr6r7rrr	�test_readlines�s$	z#PseudeInputFilesTest.test_readlinescCs�t�}t|dd�}|jdddg�|j|j�|j|j�d�|j�|j|j�|j|j�d�|jt	|jd�dS)NrSzutf-8zone
ztwo
rTr )
rrr#r/r0r)rrr9rE)rr6r7rrr	rQ�s	
zPseudeInputFilesTest.test_closeN)	rrrr8r?rYr]r_rQrrrr	rR�s	rR�__main__)
Zunittestr'Zidlelib.PyShellrrrDrrZTestCaser$rRr�mainrrrr	�<module>sZf

?>