Your IP : 216.73.216.213


Current Path : /opt/alt/python38/lib64/python3.8/test/test_asyncio/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/test/test_asyncio/__pycache__/test_buffered_proto.cpython-38.pyc

U

i�f!	�@s�ddlZddlZddlmZdd�ZGdd�dej�ZGdd�dej�Z	Gd	d
�d
e	ej
�Ze�e
ed�d�Gd
d�de	ej
��Zedkr�e��dS)�N)�
functionalcCst�d�dS�N)�asyncioZset_event_loop_policy�rr�J/opt/alt/python38/lib64/python3.8/test/test_asyncio/test_buffered_proto.py�tearDownModulesrc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�ReceiveStuffProtocCs||_||_dSr)�cb�con_lost_fut)�selfr	r
rrr�__init__szReceiveStuffProto.__init__cCstd�|_|jS)N�d)�	bytearray�buffer)r�sizehintrrr�
get_buffers
zReceiveStuffProto.get_buffercCs|�|jd|��dSr)r	r)r�nbytesrrr�buffer_updatedsz ReceiveStuffProto.buffer_updatedcCs&|dkr|j�d�n|j�|�dSr)r
Z
set_resultZ
set_exception)r�excrrr�connection_lostsz!ReceiveStuffProto.connection_lostN)�__name__�
__module__�__qualname__rrrrrrrrrsrc@seZdZdd�Zdd�ZdS)�BaseTestBufferedProtocolcCst�dSr)�NotImplementedError�rrrr�new_loop sz!BaseTestBufferedProtocol.new_loopcszdd���fdd�}�fdd�}�j�t�|dd��}|jd��}�j�t�||�d	��|���j�|���dS)
Ns	12345678+ic�sRd����fdd���j����jj��fdd�f|��IdH\�}�IdHdS)N�cs�|7���kr��d�dS)N�1)�write)Zbuf)�NOISE�data�trrr�on_buf*sz^BaseTestBufferedProtocol.test_buffered_proto_create_connection.<locals>.client.<locals>.on_bufcs
t���Sr)rr)�
conn_lost_futr#rr�<lambda>3rz`BaseTestBufferedProtocol.test_buffered_proto_create_connection.<locals>.client.<locals>.<lambda>)�loopZ
create_futureZcreate_connection)�addrZpr�r r)r$r!r#r"r�client's
��zNBaseTestBufferedProtocol.test_buffered_proto_create_connection.<locals>.clientc�s4|���|�d�IdH|��|��IdHdS)N�)rZreadexactly�close�wait_closed)�reader�writer)r rr�on_server_client7s
zXBaseTestBufferedProtocol.test_buffered_proto_create_connection.<locals>.on_server_clientz	127.0.0.1r�)	r&Zrun_until_completerZstart_serverZsocketsZgetsocknameZwait_forr+r,)rr)r/Zsrvr'rr(r�%test_buffered_proto_create_connection#s ���z>BaseTestBufferedProtocol.test_buffered_proto_create_connectionN)rrrrr1rrrrrsrc@seZdZdd�ZdS)�BufferedProtocolSelectorTestscCst��Sr)rZSelectorEventLooprrrrrLsz&BufferedProtocolSelectorTests.new_loopN�rrrrrrrrr2Isr2�ProactorEventLoopzWindows onlyc@seZdZdd�ZdS)�BufferedProtocolProactorTestscCst��Sr)rr4rrrrrTsz&BufferedProtocolProactorTests.new_loopNr3rrrrr5Psr5�__main__)rZunittestZtest.test_asynciorZ
func_testsrZBufferedProtocolrZFunctionalTestCaseMixinrZTestCaser2Z
skipUnless�hasattrr5r�mainrrrr�<module>s+��