Your IP : 216.73.216.213


Current Path : /opt/alt/python34/lib64/python3.4/test/test_asyncio/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/test/test_asyncio/__pycache__/test_streams.cpython-34.pyc

�
f f�z�@s�dZddlZddlZddlZddlZddlZddlZddlZddlmZyddl	Z	Wne
k
r�dZ	YnXddlZddlmZGdd�dej
�Zedkr�ej�ndS)zTests for streams.py.�N)�mock)�
test_utilscs�eZdZdZdd�Z�fdd�Zejd�dd��Zd	d
�Z	dd�Z
eje
ed
�d�dd��Zdd�Zejedkd�dd��Zejedkd�eje
ed
�d�dd���Zdd�Zdd�Zeje
ed
�d�dd��Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Z d1d2�Z!d3d4�Z"d5d6�Z#d7d8�Z$d9d:�Z%d;d<�Z&d=d>�Z'd?d@�Z(dAdB�Z)dCdD�Z*dEdF�Z+dGdH�Z,dIdJ�Z-dKdL�Z.dMdN�Z/dOdP�Z0dQdR�Z1dSdT�Z2dUdV�Z3dWdX�Z4dYdZ�Z5d[d\�Z6d]d^�Z7d_d`�Z8eje
ed
�d�dadb��Z9eje:j;dckdd�dedf��Z<dgdh�Z=didj�Z>dkdl�Z?dmdn�Z@dodp�ZAdqdr�ZBdsdt�ZCdudv�ZDdwdx�ZEdydz�ZF�S){�StreamReaderTestssline1
line2
line3
cCs#tj�|_|j|j�dS)N)�asyncioZnew_event_loop�loop�set_event_loop)�self�r	�C/opt/alt/python34/lib64/python3.4/test/test_asyncio/test_streams.py�setUpszStreamReaderTests.setUpcs8tj|j�|jj�tj�t�j�dS)N)r�run_brieflyr�close�gcZcollect�super�tearDown)r)�	__class__r	r
rs

zStreamReaderTests.tearDownzasyncio.streams.eventscCs)tj�}|j|j|jj�dS)N)r�StreamReader�assertIs�_loopZget_event_loop�return_value)rZm_events�streamr	r	r
�test_ctor_global_loop$sz'StreamReaderTests.test_ctor_global_loopcCs�|jj|�\}}|jd�|j�}|jj|�}|j|d�|j�}|jj|�}|j|jd��|j�dS)NsGET / HTTP/1.0

sHTTP/1.0 200 OK
s

Test message)	r�run_until_complete�write�readline�assertEqual�read�
assertTrue�endswithr
)r�open_connection_fut�reader�writer�f�datar	r	r
�_basetest_open_connection)s
z+StreamReaderTests._basetest_open_connectioncCsAtj��/}tjd|j|j�}|j|�WdQXdS)Nr)r�run_test_serverr�open_connectionr�addressr$)r�httpd�conn_futr	r	r
�test_open_connection4s	z&StreamReaderTests.test_open_connectionZAF_UNIXzNo UNIX SocketscCsAtj��/}tj|jd|j�}|j|�WdQXdS)Nr)r�run_test_unix_serverr�open_unix_connectionr'rr$)rr(r)r	r	r
�test_open_unix_connection:sz+StreamReaderTests.test_open_unix_connectioncCs|z|jj|�\}}Wdtjd�X|jd�|j�}|jj|�}|j|jd��|j�dS)NsGET / HTTP/1.0

s

Test message)	rrrrrrrrr
)rrr r!r"r#r	r	r
�%_basetest_open_connection_no_loop_sslAs
z7StreamReaderTests._basetest_open_connection_no_loop_sslNz
No ssl modulec
CsStjdd��;}tjdtj�d|j|j�}|j|�WdQXdS)N�use_sslT�sslr)rr%rr&�dummy_ssl_contextrr'r.)rr(r)r	r	r
� test_open_connection_no_loop_sslMs
	z2StreamReaderTests.test_open_connection_no_loop_sslcCsYtjdd��A}tj|jdtj�ddd|j�}|j|�WdQXdS)Nr/Tr0Zserver_hostname�r)rr+rr,r'r1rr.)rr(r)r	r	r
�%test_open_unix_connection_no_loop_sslWs	z7StreamReaderTests.test_open_unix_connection_no_loop_sslc	Cs{|jj|�\}}|jjt��|j�}|jt��|jj|�WdQX|j�tj	|j�dS)N)
rrZ	_protocolZconnection_lost�ZeroDivisionErrorr�assertRaisesr
rr)rrr r!r"r	r	r
�_basetest_open_connection_errorcs
z1StreamReaderTests._basetest_open_connection_errorcCsAtj��/}tjd|j|j�}|j|�WdQXdS)Nr)rr%rr&rr'r7)rr(r)r	r	r
�test_open_connection_errorls	z,StreamReaderTests.test_open_connection_errorcCsAtj��/}tj|jd|j�}|j|�WdQXdS)Nr)rr+rr,r'rr7)rr(r)r	r	r
�test_open_unix_connection_errorrsz1StreamReaderTests.test_open_unix_connection_errorcCs9tjd|j�}|jd�|jd|j�dS)Nr�)rrr�	feed_datar�_buffer)rrr	r	r
�test_feed_empty_datays
z&StreamReaderTests.test_feed_empty_datacCs?tjd|j�}|j|j�|j|j|j�dS)Nr)rrrr;�DATArr<)rrr	r	r
�test_feed_nonempty_datasz)StreamReaderTests.test_feed_nonempty_datacCsjtjd|j�}|j|j�|jj|jd��}|jd|�|j|j|j�dS)Nrrr:)	rrrr;r>rrrr<)rrr#r	r	r
�test_read_zero�s
z StreamReaderTests.test_read_zerocs�tjd�j��tj�jd�d�j�}��fdd�}�jj|��jj|�}�j�j|��jd�j	�dS)Nr�cs�j�j�dS)N)r;r>r	)rrr	r
�cb�sz'StreamReaderTests.test_read.<locals>.cbr:)
rrr�Taskr�	call_soonrrr>r<)r�	read_taskrBr#r	)rrr
�	test_read�s!zStreamReaderTests.test_readcCsqtjd|j�}|jd�|jd�|jj|jd��}|jd|�|jd|j�dS)Nrsline1sline2�)rrrr;rrrr<)rrr#r	r	r
�test_read_line_breaks�s

z'StreamReaderTests.test_read_line_breakscs�tjd|j��tj�jd�d|j�}�fdd�}|jj|�|jj|�}|jd|�|jd�j�dS)Nrics�j�dS)N)�feed_eofr	)rr	r
rB�sz+StreamReaderTests.test_read_eof.<locals>.cbr:)	rrrrCrrDrrr<)rrErBr#r	)rr
�
test_read_eof�s!zStreamReaderTests.test_read_eofcs�tjd|j��tj�jd�d|j�}�fdd�}|jj|�|jj|�}|jd|�|jd�j�dS)Nr�cs(�jd��jd��j�dS)Nschunk1
schunk2)r;rIr	)rr	r
rB�s

z1StreamReaderTests.test_read_until_eof.<locals>.cbs
chunk1
chunk2r:���)	rrrrCrrDrrr<)rrErBr#r	)rr
�test_read_until_eof�s!z%StreamReaderTests.test_read_until_eofcCs�tjd|j�}|jd�|jj|jd��}|jd|�|jt��|j	t|jj|jd��dS)Nrsline
�sli)
rrrr;rrr�
set_exception�
ValueErrorr6)rrr#r	r	r
�test_read_exception�s
z%StreamReaderTests.test_read_exceptioncCsh|jtd��tjddd|j�WdQX|jtd��tjddd|j�WdQXdS)NZimit�limitrrrKrL)�assertRaisesRegexrPrrr)rr	r	r
�test_invalid_limit�sz$StreamReaderTests.test_invalid_limitcCsjtjddd|j�}|jd�|jj|jd��}|jd|�|jd|j�dS)NrR�rschunkrGr:)rrrr;rrrr<)rrr#r	r	r
�test_read_limit�s

z!StreamReaderTests.test_read_limitcs�tjd|j���jd�tj�j�d|j�}�fdd�}|jj|�|jj|�}|jd|�|jd�j	�dS)Nrschunk1 cs+�jd��jd��jd�dS)Nschunk2 schunk3 s
 chunk4)r;r	)rr	r
rB�s

z+StreamReaderTests.test_readline.<locals>.cbschunk1 chunk2 chunk3 
s chunk4)
rrrr;rCrrDrrr<)rrErB�liner	)rr
�
test_readline�s
zStreamReaderTests.test_readlinecCs�tjddd|j�}|jd�|jd�|jt|jj|j��|jd|j	�tjddd|j�}|jd�|jd�|jd�|jt|jj|j��|jd|j	�dS)	NrRrUrslis
ne1
line2
sline2
sne1r:)
rrrr;r6rPrrrr<)rrr	r	r
�&test_readline_limit_with_existing_data�s




z8StreamReaderTests.test_readline_limit_with_existing_datacCs�tjd|j�}|j|j��|jd�|j|j��|jj|j��|j|j��|jd�|j�|jj|j��|j	|j��dS)Nrs
some data
)
rrrZassertFalseZat_eofr;rrrIr)rrr	r	r
�test_at_eofs


zStreamReaderTests.test_at_eofcs�tjddd|j���fdd�}|jj|�|jt|jj�j��|jd�j	�tjddd|j���fdd�}|jj|�|jt|jj�j��|jd�j	�tjddd|j���j
d	�|jj�j��}|jd	|�|jd�j	��j
d
�|jt��}|jj�j��WdQX|jd�j	��j
d�|jt��}|jj�j��WdQX|jd�j	�dS)NrR�rcs5�jd��jd��jd��j�dS)Nschunk1schunk2schunk3
)r;rIr	)rr	r
rBs


z1StreamReaderTests.test_readline_limit.<locals>.cbr:cs5�jd��jd��jd��j�dS)Nschunk1schunk2
schunk3
)r;rIr	)rr	r
rB*s


schunk3
s1234567
s	12345678
s12345678)rrrrDr6rPrrrr<r;)rrBrW�cmr	)rr
�test_readline_limits2


z%StreamReaderTests.test_readline_limitcCs�tjd|j�}|j|jdd��|j|jdd��|jj|j��}|jd|�|jd|j�dS)Nr�sline1
sline2
line3
)	rrrr;r>rrrr<)rrrWr	r	r
�test_readline_nolimit_nowaitFsz.StreamReaderTests.test_readline_nolimit_nowaitcCsXtjd|j�}|jd�|j�|jj|j��}|jd|�dS)Nrs	some data)rrrr;rIrrr)rrrWr	r	r
�test_readline_eofRs


z#StreamReaderTests.test_readline_eofcCsKtjd|j�}|j�|jj|j��}|jd|�dS)Nrr:)rrrrIrrr)rrrWr	r	r
�test_readline_empty_eofZs
z)StreamReaderTests.test_readline_empty_eofcCs}tjd|j�}|j|j�|jj|j��|jj|jd��}|jd|�|jd|j	�dS)Nrr[sline2
lsine3
)
rrrr;r>rrrrr<)rrr#r	r	r
�test_readline_read_byte_countasz/StreamReaderTests.test_readline_read_byte_countcCs�tjd|j�}|jd�|jj|j��}|jd|�|jt��|j	t|jj|j��|jd|j
�dS)Nrsline
r:)rrrr;rrrrOrPr6r<)rrr#r	r	r
�test_readline_exceptionls
z)StreamReaderTests.test_readline_exceptioncCsNtjd|j�}|jtd��!|jj|jdd��WdQXdS)NrzSeparator should be�	separatorr:)rrrrSrPr�	readuntil)rrr	r	r
�test_readuntil_separatorxsz*StreamReaderTests.test_readuntil_separatorcCs�tjd|j�}|jd�|jj|jdd��}|jd|�|jd|j�|jd�|jj|jd��}|jd|�|jd|j�|jd�|jj|jd��}|jd|�|jd|j�dS)NrslineAAArdsAAAr:s
lineAAAxxxsxxx)rrrr;rrerr<)rrr#r	r	r
�test_readuntil_multi_chunks}s


z-StreamReaderTests.test_readuntil_multi_chunkscCs�tjd|j�}|jd�|jd�|jd�|jj|jd��}|jd|�|jd|j�|jd�|jd�|jd	�|jj|jd��}|jd|�|jd|j�|jd�|jj|jd��}|jd|�|jd|j�|jd
�|jj|jd��}|jd
|�|jd|j�|jd�|jd�|jd�|jd�|jj|jd��}|jd|�|jd|j�dS)
NrsQWEaasXYaa�asaaas
QWEaaXYaaar:sXYasaasXaaasXXXsXXXaaa)rrrr;rrerr<)rrr#r	r	r
�test_readuntil_multi_chunks_1�s8











z/StreamReaderTests.test_readuntil_multi_chunks_1c
Cs�tjd|j�}|jd�|j�|jtj�� }|jj|jd��WdQX|j	|j
jd�|j|j
j
�|j	d|j�dS)Nrssome dataAAsAAAr:)rrrr;rIr6�IncompleteReadErrorrrer�	exception�partial�assertIsNone�expectedr<)rrr\r	r	r
�test_readuntil_eof�s

z$StreamReaderTests.test_readuntil_eofcCs�tjd|jdd�}|jd�|jtjd�� }|jj|jd��WdQX|jd|j	�|jd�|jtjd�� }|jj|jd��WdQX|jd	|j	�dS)
NrrRrUssome dataAAz	not foundsAAA�Azis foundssome dataAAA)
rrrr;rSZLimitOverrunErrorrrerr<)rrr\r	r	r
�test_readuntil_limit_found_sep�s

z0StreamReaderTests.test_readuntil_limit_found_sepc
Cs�tjd|j�}|j|j�|jj|jd��}|jd|�|j|j|j�|j	t
d��|jj|jd��WdQX|j|j|j�dS)Nrrr:zless than zerorKrL)rrrr;r>r�readexactlyrr<rSrP)rrr#r	r	r
�test_readexactly_zero_or_less�sz/StreamReaderTests.test_readexactly_zero_or_lesscs�tjd�j��dt�j�}tj�j|�d�j�}��fdd�}�jj|��jj|�}�j	�j�j|��j	�j�j
�dS)NrrNcs4�j�j��j�j��j�j�dS)N)r;r>r	)rrr	r
rB�sz.StreamReaderTests.test_readexactly.<locals>.cb)rrr�lenr>rCrrrDrrr<)r�nrErBr#r	)rrr
�test_readexactly�s!z"StreamReaderTests.test_readexactlycCsjtjddd|j�}|jd�|jj|jd��}|jd|�|jd|j�dS)NrRrUrschunkrGr:)rrrr;rrrrr<)rrr#r	r	r
�test_readexactly_limit�s

z(StreamReaderTests.test_readexactly_limitc	s�tjd�j��dt�j�}tj�j|�d�j�}��fdd�}�jj|��jtj	��}�jj
|�WdQX�j|jj
�j��j|jj|��jt|j�d��jd�j�dS)NrrNcs�j�j��j�dS)N)r;r>rIr	)rrr	r
rB�sz2StreamReaderTests.test_readexactly_eof.<locals>.cbz-18 bytes read on a total of 36 expected bytesr:)rrrrtr>rCrrrDr6rjrrrkrlrn�strr<)rrurErBr\r	)rrr
�test_readexactly_eof�s!z&StreamReaderTests.test_readexactly_eofcCs�tjd|j�}|jd�|jj|jd��}|jd|�|jt��|j	t|jj|jd��dS)Nrsline
rNsli)
rrrr;rrrrrOrPr6)rrr#r	r	r
�test_readexactly_exceptions
z,StreamReaderTests.test_readexactly_exceptioncCsXtjd|j�}|j|j��t�}|j|�|j|j�|�dS)Nr)rrrrmrkrPrOr)rr�excr	r	r
�test_exceptions
	
z StreamReaderTests.test_exceptioncs�tjd|j��tj�fdd��}tj�j�d|j�}tj|�d|j�}|jjtj||gd|j��|jt	|j
�dS)Nrcs�jt��dS)N)rOrPr	)rr	r
�set_errsz8StreamReaderTests.test_exception_waiter.<locals>.set_err)rrr�	coroutinerCrr�waitr6rP�result)rr}Zt1Zt2r	)rr
�test_exception_waiters(z'StreamReaderTests.test_exception_waitercCs�tjd|j�}tj|j�d|j�}tj|j�|j�tj|j�|jt	d��tj|j�|j
|jd�dS)Nr�message)rrrrCrrrZcancelrO�RuntimeErrorr�_waiter)rr�tr	r	r
�test_exception_cancel's
z'StreamReaderTests.test_exception_cancelcs�Gdd�d�}tj�fdd��}|�j�}|j�}�jjtj||�d�j��}|j��j|d�|�j�}|j�}�jjtj||�d�j��}|j��j|d�dS)Nc@saeZdZdd�Zejdd��Zdd�Zdd�Zd	d
�Z	dd�Z
d
S)z5StreamReaderTests.test_start_server.<locals>.MyServercSsd|_||_dS)N)�serverr)rrr	r	r
�__init__7s	z>StreamReaderTests.test_start_server.<locals>.MyServer.__init__css;|j�DdH}|j|�|j�DdH|j�dS)N)rr�drainr
)r�
client_reader�
client_writerr#r	r	r
�
handle_client;s
zCStreamReaderTests.test_start_server.<locals>.MyServer.handle_clientcSsStj�}|jd�|jjtj|jd|d|j��|_|j�S)N�	127.0.0.1r�sockr)r�r)	�socket�bindrrr�start_serverr�r��getsockname)rr�r	r	r
�startBs
	z;StreamReaderTests.test_start_server.<locals>.MyServer.startcSs |jj|j||��dS)N)r�create_taskr�)rr�r�r	r	r
�handle_client_callbackKszLStreamReaderTests.test_start_server.<locals>.MyServer.handle_client_callbackc	Ssqtj�}|jd�|j�}|j�|jjtj|jd|dd|dd|j��|_	|S)N�	127.0.0.1r�host�portrKr)r�r)
r�r�r�r
rrrr�r�r�)rr��addrr	r	r
�start_callbackOs

	zDStreamReaderTests.test_start_server.<locals>.MyServer.start_callbackcSsE|jdk	rA|jj�|jj|jj��d|_ndS)N)r�r
rr�wait_closed)rr	r	r
�stopZs
z:StreamReaderTests.test_start_server.<locals>.MyServer.stopN)�__name__�
__module__�__qualname__r�rr~r�r�r�r�r�r	r	r	r
�MyServer5s	r�c3sOtjd�j|�DdH\}}|jd�|j�DdH}|j�|S)Nrs
hello world!
)rr&rrrr
)r�r r!�msgback)rr	r
�client`s	

z3StreamReaderTests.test_start_server.<locals>.clientrs
hello world!
)	rr~rr�rrCr�rr�)rr�r�r�r��msgr	)rr
�test_start_server3s+

z#StreamReaderTests.test_start_servercsGdd�d�}tj�fdd��}tj��g}|�j|�}|j��jjtj||�d�j��}|j��j	|d�WdQXtj��g}|�j|�}|j
��jjtj||�d�j��}|j��j	|d�WdQXdS)Nc@saeZdZdd�Zejdd��Zdd�Zdd�Zd	d
�Z	dd�Z
d
S)z:StreamReaderTests.test_start_unix_server.<locals>.MyServercSsd|_||_||_dS)N)r�r�path)rrr�r	r	r
r��s		zCStreamReaderTests.test_start_unix_server.<locals>.MyServer.__init__css;|j�DdH}|j|�|j�DdH|j�dS)N)rrr�r
)rr�r�r#r	r	r
r��s
zHStreamReaderTests.test_start_unix_server.<locals>.MyServer.handle_clientcSs7|jjtj|jd|jd|j��|_dS)Nr�r)rrr�start_unix_serverr�r�r�)rr	r	r
r��s		z@StreamReaderTests.test_start_unix_server.<locals>.MyServer.startcSs |jj|j||��dS)N)rr�r�)rr�r�r	r	r
r��szQStreamReaderTests.test_start_unix_server.<locals>.MyServer.handle_client_callbackcSs=tj|jd|jd|j�}|jj|�|_dS)Nr�r)rr�r�r�rrr�)rr�r	r	r
r��s	zIStreamReaderTests.test_start_unix_server.<locals>.MyServer.start_callbackcSsE|jdk	rA|jj�|jj|jj��d|_ndS)N)r�r
rrr�)rr	r	r
r��s
z?StreamReaderTests.test_start_unix_server.<locals>.MyServer.stopN)r�r�r�r�rr~r�r�r�r�r�r	r	r	r
r�~sr�c3sOtj|d�j�DdH\}}|jd�|j�DdH}|j�|S)Nrs
hello world!
)rr,rrrr
)r�r r!r�)rr	r
r��s

z8StreamReaderTests.test_start_unix_server.<locals>.clientrs
hello world!
)rr~rZunix_socket_pathrr�rrCr�rr�)rr�r�r�r�r�r	)rr
�test_start_unix_server{s $



z(StreamReaderTests.test_start_unix_server�win32zDon't have pipesc
snd}tj�\}}tjd|t|�g}t|dd�}tjd|jdd�}tj	|d|j��|jj
|jj�fdd	�|��\}}tj�}	|	j
|j�zZtj|	�tjd
|hd|j|�}
|jj
|
�}|jj
|j��Wdtjd�Xtj|�|jj
|jd��}|j|d�dS)
NzHimport os, sys
fd = int(sys.argv[1])
os.write(fd, b'data')
os.close(fd)
z-c�rbrrrRrKcs�S)Nr	r	)�protocolr	r
�<lambda>�szBStreamReaderTests.test_read_all_from_pipe_reader.<locals>.<lambda>Zpass_fdssdatarL)�os�pipe�sys�
executablerx�openrrr�StreamReaderProtocolrZconnect_read_pipeZSafeChildWatcherZattach_loopZset_child_watcherZcreate_subprocess_execrr
rr)
r�codeZrfdZwfd�argsr�r Z	transport�_Zwatcher�create�procr#r	)r�r
�test_read_all_from_pipe_reader�s*
	*
		
z0StreamReaderTests.test_read_all_from_pipe_readercCsI|jtjd�tj|j�tj�}|j|j|j�dS)N)�
addCleanuprrrrrr)rr r	r	r
�test_streamreader_constructor�sz/StreamReaderTests.test_streamreader_constructorcCsX|jtjd�tj|j�tj�}tj|�}|j|j|j�dS)N)	r�rrrr�Mockr�rr)rr r�r	r	r
�%test_streamreaderprotocol_constructor�s
z7StreamReaderTests.test_streamreaderprotocol_constructorc
s�tj���fdd�}tj�fdd��}tjd|�}|jd�|j��j�}�j	t
tf���jj
||��WdQX|j�dS)Nc
sltj�}|�T|jd�|jd�|j�}�j|�|j�\}}|j�WdQXdS)N�	localhostrrK)r�r)r�r�Zlistenr�ZputZacceptr
)r�r�Zcltr�)�qr	r
r�s


z3StreamReaderTests.test_drain_raises.<locals>.serverc3sMtj||d�j�DdH\}}x |jd�|j�DdHq)WdS)Nrsfoo
)rr&rrr�)r�r�r r!)rr	r
r�s
 
z3StreamReaderTests.test_drain_raises.<locals>.client�targetT)�queueZQueuerr~�	threadingZThreadZ	setDaemonr��getr6�ConnectionResetError�BrokenPipeErrorrr�join)rr�r�Zthreadr�r	)r�rr
�test_drain_raises�s


z#StreamReaderTests.test_drain_raisescCs/tjd|j�}|jdt|��dS)Nrz<StreamReader>)rrrr�repr)rrr	r	r
�
test___repr__%szStreamReaderTests.test___repr__cCs5tjd|jdd�}|jdt|��dS)NrrR�{z<StreamReader l=123>)rrrrr�)rrr	r	r
�test___repr__nondefault_limit)sz/StreamReaderTests.test___repr__nondefault_limitcCs9tjd|j�}|j�|jdt|��dS)Nrz<StreamReader eof>)rrrrIrr�)rrr	r	r
�test___repr__eof-s
z"StreamReaderTests.test___repr__eofcCs<tjd|j�}|jd�|jdt|��dS)Nrsdataz<StreamReader 4 bytes>)rrrr;rr�)rrr	r	r
�test___repr__data2s
z#StreamReaderTests.test___repr__datacCsEtjd|j�}t�}|j|�|jdt|��dS)Nrz<StreamReader e=RuntimeError()>)rrrr�rOrr�)rrr{r	r	r
�test___repr__exception7s	
z(StreamReaderTests.test___repr__exceptioncCs�tjd|j�}tjd|j�|_|jt|�d�|jjd�|jj|j�d|_|j	dt|��dS)Nrz'<StreamReader w=<Future pending[\S ]*>>z<StreamReader>)
rrrZFuturer�ZassertRegexr�Z
set_resultrr)rrr	r	r
�test___repr__waiter=s		z%StreamReaderTests.test___repr__waitercCs_tjd|j�}tj�|_tj�|j_d|jj_|jdt	|��dS)Nrz<Transport>z<StreamReader t=<Transport>>)
rrrrr�Z
_transport�__repr__rrr�)rrr	r	r
�test___repr__transportHs
z(StreamReaderTests.test___repr__transport)Gr�r�r�r>rrrZpatchrr$r*�unittestZ
skipUnless�hasattrr�r-r.ZskipIfr0r2r4r7r8r9r=r?r@rFrHrJrMrQrTrVrXrYrZr]r_r`rarbrcrfrgrirorqrsrvrwryrzr|r�r�r�r�r��platformr�r�r�r�r�r�r�r�r�r�r�r	r	)rr
rsv'$
*	'	

/#
H'D''	
,r�__main__)�__doc__rr�r�r�r�r�r�rr0�ImportErrorrrZTestCaserr��mainr	r	r	r
�<module>s(
���?