%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/twisted/internet/test/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/twisted/internet/test/__pycache__/test_epollreactor.cpython-312.pyc

�

Ϫ�f����dZddlmZddlmZddlmZddlmZddl	m
Z
	ddlmZGd	�d
�Zeed�Gd�d
e
��Zy#e
$rdZY�,wxYw)z-
Tests for L{twisted.internet.epollreactor}.
�)�skipIf��ConnectionDone)�_ContinuousPolling)�Clock)�TestCase)�epollreactorNc�.�eZdZdZd�Zd�Zd�Zd�Zd�Zy)�
DescriptorzF
    Records reads and writes, as if it were a C{FileDescriptor}.
    c��g|_y�N)�events��selfs �I/usr/lib/python3/dist-packages/twisted/internet/test/test_epollreactor.py�__init__zDescriptor.__init__s	�����c��y)N��rs r�filenozDescriptor.filenos��rc�:�|jjd�y)N�read�r�appendrs r�doReadzDescriptor.doRead s�������6�"rc�:�|jjd�y)N�writerrs r�doWritezDescriptor.doWrite#s�������7�#rc�d�|jt�|jjd�y)N�lost)�traprrr)r�reasons  r�connectionLostzDescriptor.connectionLost&s �����N�#������6�"rN)	�__name__�
__module__�__qualname__�__doc__rrrrr$rrrrrs �����#�$�#rrz(epoll not supported in this environment.c�^�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zy)�ContinuousPollingTestsza
    L{_ContinuousPolling} can be used to read and write from C{FileDescriptor}
    objects.
    c��tt��}|j|j�t	�}|j|j
|��|j|�|j|j�|j|jj�|j|jj|j�|j|j
|��y)zi
        Adding a reader when there was previously no reader starts up a
        C{LoopingCall}.
        N)rr�assertIsNone�_loop�object�assertFalse�	isReading�	addReader�assertIsNotNone�
assertTrue�running�assertIs�clock�_reactor�r�poller�readers   r�test_addReaderz%ContinuousPollingTests.test_addReader2���
$�E�G�,�����&�,�,�'��������)�)�&�1�2����� ����V�\�\�*�������,�,�-��
�
�f�l�l�(�(�&�/�/�:�����(�(��0�1rc��tt��}|j|j�t	�}|j|j
|��|j|�|j|j�|j|jj�|j|jj|j�|j|j
|��y)zi
        Adding a writer when there was previously no writer starts up a
        C{LoopingCall}.
        N)rrr,r-r.r/�	isWriting�	addWriterr2r3r4r5r6r7�rr9�writers   r�test_addWriterz%ContinuousPollingTests.test_addWriterAr<rc�L�tt��}t�}|j|�|j	|�|j|j�|j|jj�g�|j|j|��y)z=
        Removing a reader stops the C{LoopingCall}.
        N)rrr.r1�removeReaderr,r-�assertEqualr7�getDelayedCallsr/r0r8s   r�test_removeReaderz(ContinuousPollingTests.test_removeReaderP�{��$�E�G�,��������� ����F�#����&�,�,�'�������8�8�:�B�?�����)�)�&�1�2rc�L�tt��}t�}|j|�|j	|�|j|j�|j|jj�g�|j|j|��y)z=
        Removing a writer stops the C{LoopingCall}.
        N)rrr.r?�removeWriterr,r-rEr7rFr/r>r@s   r�test_removeWriterz(ContinuousPollingTests.test_removeWriter\rHrc��tt��}|jt��|j	t��y)zM
        Removing unknown readers and writers silently does nothing.
        N)rrrJr.rD)rr9s  r�test_removeUnknownz)ContinuousPollingTests.test_removeUnknownhs0��$�E�G�,�����F�H�%����F�H�%rc��tt��}t�}|j|�|j	|j
�|jt��|j	|j
�|j
t��|j	|j
�|j
t��|j|�|j	|j
�|j|j
j�|jt|jj��d�y)za
        Adding multiple readers and writers results in a single
        C{LoopingCall}.
        rN)rrr.r?r2r-r1rJr3r4rE�lenr7rFr@s   r�test_multipleReadersAndWritersz5ContinuousPollingTests.test_multipleReadersAndWritersps���
$�E�G�,��������� ����V�\�\�*������"����V�\�\�*������"����V�\�\�*������"����F�#����V�\�\�*�������,�,�-�����V�_�_�<�<�>�?��Crc��t�}t|�}t�}|j|�|j	|j
g�|j
d�|j	|j
dg�|j
d�|j	|j
ddg�|j
d�|j	|j
gd��y)za
        Adding a reader causes its C{doRead} to be called every 1
        milliseconds.
        g�h㈵��>r)rrrN)rrrr1rEr�advance�r�reactorr9�descs    r�test_readerPollingz)ContinuousPollingTests.test_readerPolling�s���
�'��#�G�,���|�������������b�)����� �������v�h�/����� �������v�v�&6�7����� �������&>�?rc��t�}t|�}t�}|j|�|j	|j
g�|j
d�|j	|j
dg�|j
d�|j	|j
ddg�|j
d�|j	|j
gd��y)zb
        Adding a writer causes its C{doWrite} to be called every 1
        milliseconds.
        ���MbP?r)rrrN)rrrr?rErrRrSs    r�test_writerPollingz)ContinuousPollingTests.test_writerPolling�s���
�'��#�G�,���|�������������b�)������������w�i�0������������w��&8�9������������&A�Brc��t�}t|�}t�}d�|_|j	|�|j|jg�|jd�|j|jdg�y)zu
        If a C{doRead} returns a value indicating disconnection,
        C{connectionLost} is called on it.
        c��t�Sr
rrrr�<lambda>zBContinuousPollingTests.test_connectionLostOnRead.<locals>.<lambda>�s	��n�.�rrXr!N)rrrrr1rErrRrSs    r�test_connectionLostOnReadz0ContinuousPollingTests.test_connectionLostOnRead�sg��
�'��#�G�,���|��.��������������b�)������������v�h�/rc��t�}t|�}t�}d�|_|j	|�|j|jg�|jd�|j|jdg�y)zv
        If a C{doWrite} returns a value indicating disconnection,
        C{connectionLost} is called on it.
        c��t�Sr
rrrrr\zCContinuousPollingTests.test_connectionLostOnWrite.<locals>.<lambda>�s	��~�/�rrXr!N)rrrrr?rErrRrSs    r�test_connectionLostOnWritez1ContinuousPollingTests.test_connectionLostOnWrite�sg��
�'��#�G�,���|��/��������������b�)������������v�h�/rc��tt��}t�}t�}t�}|j|�|j|�|j	|�|j	|�|j�}|j
|j�g�|j
|j�g�|j
t|�d�|j
t|�|||h�y)zv
        L{_ContinuousPolling.removeAll} removes all descriptors and returns
        the readers and writers.
        �N)rrr.r1r?�	removeAllrE�
getReaders�
getWritersrO�set)rr9r:rA�both�removeds      r�test_removeAllz%ContinuousPollingTests.test_removeAll�s���
$�E�G�,���������x������ ���������� �������"�"�$������*�*�,�b�1�����*�*�,�b�1�����W��q�)�����W�����'=�>rc��tt��}t�}|j|�|j	||j��y)zb
        L{_ContinuousPolling.getReaders} returns a list of the read
        descriptors.
        N)rrr.r1�assertInrdr8s   r�test_getReadersz&ContinuousPollingTests.test_getReaders��<��
$�E�G�,��������� ��
�
�f�f�/�/�1�2rc��tt��}t�}|j|�|j	||j��y)zc
        L{_ContinuousPolling.getWriters} returns a list of the write
        descriptors.
        N)rrr.r?rkrer@s   r�test_getWritersz&ContinuousPollingTests.test_getWriters�rmrN)r%r&r'r(r;rBrGrKrMrPrVrYr]r`rirlrorrrr*r*+sK���

2�
2�
3�
3�&�D�&@�"C�"0�0�?�&3�3rr*)r(�unittestr�twisted.internet.errorr�twisted.internet.posixbaser�twisted.internet.taskr�twisted.trial.unittestr�twisted.internetr	�ImportErrorrr*rrr�<module>rwsm����1�9�'�+��-�
#�#�,�L��D�E�z3�X�z3�F�z3��7���L��s�A�A�A

Zerion Mini Shell 1.0