Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.12/test/test_asyncio/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.12/test/test_asyncio/__pycache__/test_transports.cpython-312.opt-1.pyc

�

(Μg����dZddlZddlmZddlZddlmZd�ZGd�dej�Zedk(rej�yy)	zTests for transports.py.�N)�mock)�
transportsc�.�tjd�y�N)�asyncio�set_event_loop_policy���>/usr/local/lib/python3.12/test/test_asyncio/test_transports.py�tearDownModuler
s���!�!�$�'r
c�6�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	y)	�TransportTestsc�d�tj�}|j|ji�yr)r�	Transport�assertEqual�_extra��self�	transports  r�test_ctor_extra_is_nonez&TransportTests.test_ctor_extra_is_nones&���%�%�'�	�����)�)�2�.r
c��tjddi�}|jd|jd��|j	|jd��t�}|j
||jd|��y)N�extra�info�unknown)rrr�get_extra_info�assertIsNone�object�assertIs)rr�defaults   r�test_get_extra_infoz"TransportTests.test_get_extra_infosm���%�%�w��&7�8�	������!9�!9�'�!B�C����)�2�2�9�=�>��(���
�
�g�y�7�7�	�7�K�Lr
c���tj��G�fd�dtj�}|�}|j	dtd�t
d�g�|jd�j��jd�y)Nc���eZdZ�fd�Zy)�3TransportTests.test_writelines.<locals>.MyTransportc����|�yrr	)r�data�writers  �r�writez9TransportTests.test_writelines.<locals>.MyTransport.write"s
����t�r
N)�__name__�
__module__�__qualname__r')r&s�r�MyTransportr#!s���
r
r+sline1sline2sline3�sline1line2line3)
r�Mockrr�
writelines�	bytearray�
memoryviewr�
call_count�assert_called_with)rr+rr&s   @r�test_writelineszTransportTests.test_writelinessu��������	�'�+�+�	� �M�	����h�'��1�(��2�4�	5�	
����F�-�-�.��!�!�"4�5r
c��tj�}|jt|j�|jt|j
�|jt|jd�|jt|j�|jt|j�|jt|j�|jt|j�|jt|j�|jt|j�|jt|j�y�Nr%)rr�assertRaises�NotImplementedError�set_write_buffer_limits�get_write_buffer_sizer'�	write_eof�
can_write_eof�
pause_reading�resume_reading�
is_reading�close�abortrs  r�test_not_implementedz#TransportTests.test_not_implemented-s����%�%�'�	����-�#�;�;�	=����-�y�/N�/N�O����-�y����G����-�y�/B�/B�C����-�y�/F�/F�G����-�y�/F�/F�G����-�y�/G�/G�H����-�y�/C�/C�D����-�y���?����-�y���?r
c��tj�}|jt|jd�|jt|j
�yr5)r�DatagramTransportr6r7�sendtor@rs  r�test_dgram_not_implementedz)TransportTests.test_dgram_not_implemented<s>���-�-�/�	����-�y�/?�/?��H����-�y���?r
c��tj�}|jt|j�|jt|j
�|jt|jd�|jt|jd�|jt|j�|jt|j�y)Nr,)
r�SubprocessTransportr6r7�get_pid�get_returncode�get_pipe_transport�send_signal�	terminate�killrs  r�)test_subprocess_transport_not_implementedz8TransportTests.test_subprocess_transport_not_implementedBs����/�/�1�	����-�y�/@�/@�A����-�y�/G�/G�H����-�y�/K�/K�Q�O����-�y�/D�/D�a�H����-�y�/B�/B�C����-�y�~�~�>r
c��Gd�dtjtj�}tj�}||��}tj�|_|j
|j�|jtd�5|jdd��ddd�|jdd	��|j
|j�|j|j�d
�|jdd	��|j|j�|j|j�d�y#1swY��xYw)
Nc��eZdZd�Zy)�KTransportTests.test_flowcontrol_mixin_set_write_limits.<locals>.MyTransportc��y)Nir	)rs rr9zaTransportTests.test_flowcontrol_mixin_set_write_limits.<locals>.MyTransport.get_write_buffer_sizeQs��r
N)r(r)r*r9r	r
rr+rQNs��
r
r+)�loopzhigh.*must be >= lowrr,)�high�low��)rWrV�)rWrX)r�_FlowControlMixinrrr-�	_protocol�assertFalse�_protocol_paused�assertRaisesRegex�
ValueErrorr8r�get_write_buffer_limits�
assertTrue)rr+rSrs    r�'test_flowcontrol_mixin_set_write_limitsz6TransportTests.test_flowcontrol_mixin_set_write_limitsLs
��	�*�6�6�$�.�.�	��y�y�{���T�*�	�"�i�i�k�	������3�3�4�
�
#�
#�J�0F�
G��-�-�1�!�-�<�H�	�)�)�t��)�=�����3�3�4�����:�:�<�k�J��)�)�s��)�<����	�2�2�3�����:�:�<�j�I�H�
G�s�E	�	EN)
r(r)r*rr r3rArErNrar	r
rrrs)��/�M�
6�
@�@�?�Jr
r�__main__)
�__doc__�unittestrrrr�TestCaserr(�mainr	r
r�<module>rgsJ�������(�SJ�X�&�&�SJ�l�z���H�M�M�O�r

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists