%PDF- %PDF-
Mini Shell

Mini Shell

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

�

Ϫ�f����dZddlmZmZmZmZmZddlmZddl	m
Z
ddlmZejZ
ddlmZGd�dej �ZGd	�d
e�ZGd�dej(�ZGd
�dej(�ZGd�dej(�ZGd�dej(�ZGd�d�ZGd�dej4�ZGd�dej4�Zy)z%
Tests for L{twisted.internet.task}.
�)�defer�error�
interfaces�reactor�task)�installReactor)�	NoReactor)�unittest)�failurec���eZdZ�fd�Z�xZS)�TestableLoopingCallc�2��t�|�|i|��||_y�N)�super�__init__�clock)�selfr�a�kw�	__class__s    ��8/usr/lib/python3/dist-packages/twisted/test/test_task.pyrzTestableLoopingCall.__init__s���
���!�"�r�"���
�)�__name__�
__module__�__qualname__r�
__classcell__)rs@rr
r
s
����rr
c��eZdZy)�
TestExceptionN�rrr�rrrrs��rrc�j�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zy)�
ClockTestsz<
    Test the non-wallclock based clock implementation.
    c�l�tj�}|j|j�d�y)zV
        Test that the C{seconds} method of the fake clock returns fake time.
        rN)r�Clock�assertEqual�seconds�r�cs  r�testSecondszClockTests.testSeconds#s%��
�J�J�L���������a�(rc�2�tj�}|jdd�dd��}|jtj
j
|��|j|j�d�|j|j��y)z{
        Test that calls can be scheduled for later with the fake clock and
        hands back an L{IDelayedCall}.
        �c��yrr �r�bs  r�<lambda>z*ClockTests.testCallLater.<locals>.<lambda>0��r��r.N)
rr$�	callLater�
assertTruer�IDelayedCall�
providedByr%�getTime�active�rr(�calls   r�
testCallLaterzClockTests.testCallLater*sk��

�J�J�L���{�{�1�/��a�{�8�����
�/�/�:�:�4�@�A���������+�������
�&rc��tj�}|jdd�dd��}|j�|j	|j��y)z3
        Test that calls can be cancelled.
        r+c��yrr r-s  rr/z3ClockTests.testCallLaterCancelled.<locals>.<lambda>:r0rr1r2N)rr$r3�cancel�assertFalser8r9s   r�testCallLaterCancelledz!ClockTests.testCallLaterCancelled5sC��
�J�J�L���{�{�1�/��a�{�8�����
��������'rc��tj�}|jdd�dd��}|jdd�dd��}|j||u�y	)
z[
        Test that the DelayedCall returned is not one previously
        created.
        �
c��yrr r-s  rr/z3ClockTests.test_callLaterOrdering.<locals>.<lambda>Dr0rr+r1r2c��yrr r-s  rr/z3ClockTests.test_callLaterOrdering.<locals>.<lambda>Er0r��N)rr$r3r?)rr(�call1�call2s    r�test_callLaterOrderingz!ClockTests.test_callLaterOrdering>sO��

�J�J�L�����B� 1�1���:�����A�0�!�q��9������%��(rc�(��g�tj�}|jd�fd��}|jd�|j	�g�|jd�|j	�dg�|j|j
��y)zE
        Test that advancing the clock will fire some calls.
        r1c�&���jd�Sr��append)�eventss�rr/z(ClockTests.testAdvance.<locals>.<lambda>Ns���f�m�m�D�&9�rr+N)rr$r3�advancer%r?r8�rr(r:rNs   @r�testAdvancezClockTests.testAdvanceHsr������J�J�L���{�{�1�9�:��	�	�	�!�������$�	�	�	�!������$��(��������'rc����tj�}��fd�}|jd|��|jd�y)a
        Test attempting to cancel the call in a callback.

        AlreadyCalled should be raised, not for example a ValueError from
        removing the call from Clock.calls. This requires call.called to be
        set before the callback is called.
        c�Z���jtj�j�yr)�assertRaisesr�
AlreadyCalledr>)r:rs��r�cbz(ClockTests.testAdvanceCancel.<locals>.cb_s������e�1�1�4�;�;�?rr+N)rr$r3rO)rr(rVr:s`  @r�testAdvanceCancelzClockTests.testAdvanceCancelUs3���
�J�J�L��	@��{�{�1�b�!��	�	�	�!�rc�R��g�tj�}|jd�fd�dd��}|jd�|j	|j�d�|j
d�|j	�g�|j
d�|j	�dg�y)	z1
        Test that calls can be delayed.
        r+c�*���j||f�SrrL�rr.rNs  �rr/z1ClockTests.testCallLaterDelayed.<locals>.<lambda>k����6�=�=�!�Q��+@�rr1r2g�?��?�r+r1N)rr$r3�delayr%r7rOrPs   @r�testCallLaterDelayedzClockTests.testCallLaterDelayedes�������J�J�L���{�{�1�@�!�q�{�I���
�
�1�
���������+�	�	�	�#�������$�	�	�	�#������&��*rc�t��g�tj�}|jd�fd�dd��}|jd�|j	d�|j|j
�d�|jd�|j�g�|jd�|j�dg�y)	zL
        Test that calls can have their time reset to a later time.
        r1c�*���j||f�SrrLrZs  �rr/z4ClockTests.testCallLaterResetLater.<locals>.<lambda>yr[rr+r2rErFr]N)rr$r3rO�resetr%r7rPs   @r�testCallLaterResetLaterz"ClockTests.testCallLaterResetLaterss�������J�J�L���{�{�1�@�!�q�{�I��	�	�	�!���
�
�1�
���������+�	�	�	�!�������$�	�	�	�!������&��*rc���g�tj�}|jd�fd�dd��}|jd�|j	|j�d�|j
d�|j	�dg�y)	zO
        Test that calls can have their time reset to an earlier time.
        rFc�*���j||f�SrrLrZs  �rr/z5ClockTests.testCallLaterResetSooner.<locals>.<lambda>�r[rr+r1r2rEr]N)rr$r3rbr%r7rOrPs   @r�testCallLaterResetSoonerz#ClockTests.testCallLaterResetSooner�sj������J�J�L���{�{�1�@�!�q�{�I���
�
�1�
���������+�	�	�	�!������&��*rc���tj�}|jdd��}|jdd��}|j�}|j	||ht|��y)zB
        Test that we can get a list of all delayed calls
        r+c��yrr ��xs rr/z1ClockTests.test_getDelayedCalls.<locals>.<lambda>�r0rr1c��yrr ris rr/z1ClockTests.test_getDelayedCalls.<locals>.<lambda>�r0rN)rr$r3�getDelayedCallsr%�set)rr(r:rH�callss     r�test_getDelayedCallszClockTests.test_getDelayedCalls�sU��
�J�J�L���{�{�1�n�-�����A�~�.���!�!�#�����$����E�
�3rc�l�tj�}|j|j�g�y)zk
        Test that we get an empty list from getDelayedCalls on a newly
        constructed Clock.
        N)rr$r%rlr's  r�test_getDelayedCallsEmptyz$ClockTests.test_getDelayedCallsEmpty�s(��

�J�J�L������*�*�,�b�1rc��tj�}|jtjj|�d�y)Nz#Clock does not provide IReactorTime)rr$r4r�IReactorTimer6r's  r�test_providesIReactorTimez$ClockTests.test_providesIReactorTime�s0���J�J�L������#�#�.�.�q�1�3X�	
rc����g�ddg}tj����fd�}�jd|d�}|jd��jd|d��j	d	gd
z�|j�|�y)a4
        The order of calls scheduled by L{task.Clock.callLater} is honored when
        adding a new call via calling L{task.Clock.callLater} again.

        For example, if L{task.Clock.callLater} is invoked with a callable "A"
        and a time t0, and then the L{IDelayedCall} which results from that is
        C{reset} to a later time t2 which is greater than t0, and I{then}
        L{task.Clock.callLater} is invoked again with a callable "B", and time
        t1 which is less than t2 but greater than t0, "B" will be invoked before
        "A".
        �r.�@�r�@c�F���j|�j�f�Sr�rMr&��nr�results ��rr/z<ClockTests.test_callLaterKeepsCallsOrdered.<locals>.<lambda>�����F�M�M�1�e�m�m�o�*>�?�rr\rryrwr.r+rEN�rr$r3rb�pumpr%�r�expected�logtime�call_arr~s    @@r�test_callLaterKeepsCallsOrderedz*ClockTests.test_callLaterKeepsCallsOrdered�st������
�+���
�
���?������g�s�3�����S��
����W�c�*�
�
�
�A�3��7�������*rc����g�ddg}tj����fd�}�jd|d�}�jd|d�|jd��j	d	gd
z�|j�|�y)a:
        The order of calls scheduled by L{task.Clock.callLater} is honored when
        re-scheduling an existing call via L{IDelayedCall.reset} on the result
        of a previous call to C{callLater}.

        For example, if L{task.Clock.callLater} is invoked with a callable "A"
        and a time t0, and then L{task.Clock.callLater} is invoked again with a
        callable "B", and time t1 greater than t0, and finally the
        L{IDelayedCall} for "A" is C{reset} to a later time, t2, which is
        greater than t1, "B" will be invoked before "A".
        rvrxc�F���j|�j�f�Srr{r|s ��rr/zAClockTests.test_callLaterResetKeepsCallsOrdered.<locals>.<lambda>�rrr\rrwr.ryr+rENr�r�s    @@r�$test_callLaterResetKeepsCallsOrderedz/ClockTests.test_callLaterResetKeepsCallsOrdered�st������
�+���
�
���?������g�s�3��
����W�c�*����S��
�
�
�A�3��7�������*rc�����g�ddg}tj����fd�}�jd|d���fd�}�jd|��jd|d	��jd
gdz�|j	�|�y)
a9
        The order of calls scheduled by L{task.Clock.callLater} is honored when
        re-scheduling an existing call via L{IDelayedCall.reset} on the result
        of a previous call to C{callLater}, even when that call to C{reset}
        occurs within the callable scheduled by C{callLater} itself.
        )r(ry)r.g@c�F���j|�j�f�Srr{r|s ��rr/zKClockTests.test_callLaterResetInsideCallKeepsCallsOrdered.<locals>.<lambda>�rrrwr.c�(���jd�y)Nry)rb)�call_bs�rrzDClockTests.test_callLaterResetInsideCallKeepsCallsOrdered.<locals>.a�s����L�L��rr\ryr(��?rBN)rr$r3r�r%)rr�r�rr�rr~s    @@@r�.test_callLaterResetInsideCallKeepsCallsOrderedz9ClockTests.test_callLaterResetInsideCallKeepsCallsOrdered�s}������
�+���
�
���?������g�s�3��	�	����Q��
����W�c�*�
�
�
�C�5�2�:�������*rN)rrr�__doc__r)r;r@rIrQrWr_rcrfrorqrtr�r�r�r rrr"r"sR���)�	'�(�)�(�� +�
+�
+�
4�2�
�+�0+�0+rr"c��eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zy)�	LoopTestsz[
    Tests for L{task.LoopingCall} based on a fake L{IReactorTime}
    implementation.
    c�p�tjd��}|j|jt�y)zG
        L{LoopingCall}'s default clock should be the reactor.
        c��yrr r rrr/z-LoopTests.test_defaultClock.<locals>.<lambda>�r0rN)r�LoopingCallr%rr)rr:s  r�test_defaultClockzLoopTests.test_defaultClock�s(������-��������W�-rc�����g�d�tj�����fd�}tj|�}�|_d�|j	d�|j�dg�|j�j
����jd�|j�dg�d��jd�|j�ddg�|j�j
�d��jd�|j�ddg�d��jd�|j�gd	��|j�j
�d
�y)z�
        When more time than the defined interval passes during the execution
        of a callback, L{LoopingCall} should schedule the next call for the
        next interval which is still in the future.
        Nc�f���j�j���j��yr)rMr&rO)�callDurationr�timess���r�	aCallbackz3LoopTests.test_callbackTimeSkips.<locals>.aCallbacks!����L�L�����)��M�M�,�'rr1r�rr+�@g@)rr�rFrF)rr$r�r�startr%r&rO)rr�r:r�rr�s   @@@r�test_callbackTimeSkipsz LoopTests.test_callbackTimeSkips�s.��������
�
���	(����	�*����
����
�
�3��	
������$�	
�������,�7�
	�
�
�a��������$���
�
�
�c�������C��)��������#�.�	�
�
�a�������C��)���
�
�
�c�������,��������!�,rc����g�tj����fd�}tj|�}�|_|j	d�|j�dg��j
d�|j�ddg��j
d�|j�gd���j
d�|j�gd��y)a	
        When more time than the defined interval passes between when
        L{LoopingCall} schedules itself to run again and when it actually
        runs again, it should schedule the next call for the next interval
        which is still in the future.
        c�D���j�j��yrr{)rr�s��rr�z2LoopTests.test_reactorTimeSkips.<locals>.aCallback;s����L�L�����)rr�rr1r+)rr1rEN)rr$r�rr�r%rO)rr�r:rr�s   @@r�test_reactorTimeSkipszLoopTests.test_reactorTimeSkips1s�������
�
���	*�
���	�*����
��
�
�3��	
������$�	�
�
�a�������A��'�	�
�
�a������	�*�	�
�
�a������	�*rc����g�tj����fd�}tjj|�}�|_d}d}|j|�|j
�dg��j||z�|j
�d||zdfg��jd|z|z�|j
�d||zdfd|zd|zzdfg��jd	�|j
�d||zdfd|zd|zzdfg�y
)a�
        When L{LoopingCall} schedules itself to run again, if more than the
        specified interval has passed, it should schedule the next call for the
        next interval which is still in the future. If it was created
        using L{LoopingCall.withCount}, a positional argument will be
        inserted at the beginning of the argument list, indicating the number
        of calls that should have been made.
        c�H���j�j�|f�yrr{)�numCallsrr�s ��rr�z7LoopTests.test_reactorTimeCountSkips.<locals>.aCallback_s����L�L�%�-�-�/�8�4�5rr��{�G�z�?�rr+r+rErFr1rN)rr$r��	withCountrr�r%rO�rr�r:�INTERVAL�REALISTIC_DELAYrr�s     @@r�test_reactorTimeCountSkipsz$LoopTests.test_reactorTimeCountSkipsSs2������
�
���	6�
���)�)�)�4����
������
�
�8��	
������)�
	�
�
�h��0�1������(�_�*D�a�)H� I�J�	�
�
�q�8�|��6�7�������O�+�Q�/��h�,�1��#6�7��;�
�	
�	�
�
�a��������O�+�Q�/��h�,�1��#6�7��;�
�	
rc�X���g�tj����fd�}tjj|�}�|_d}d}|j|�|j
�j�d��j||z�|j
�j�||zdf��j|dz�|j
�j�d|z|zdf��j|dz�|j
�j�d	|z|zdf�y
)a1
        L{LoopingCall.withCount} counts only calls that were expected to be
        made.  So, if more than one, but less than two intervals pass between
        invocations, it won't increase the count above 1.  For example, a
        L{LoopingCall} with interval T expects to be invoked at T, 2T, 3T, etc.
        However, the reactor takes some time to get around to calling it, so in
        practice it will be called at T+something, 2T+something, 3T+something;
        and due to other things going on in the reactor, "something" is
        variable.  It won't increase the count unless "something" is greater
        than T.  So if the L{LoopingCall} is invoked at T, 2.75T, and 3T,
        the count has not increased, even though the distance between
        invocation 1 and invocation 2 is 1.75T.
        c�H���j�j�|f�yrr{)�countrr�s ��rr�z<LoopTests.test_countLengthyIntervalCounts.<locals>.aCallback�s����L�L�%�-�-�/�5�1�2rr�r�r�r+g�?g@g�?ryN)	rr$r�r�rr�r%�poprOr�s     @@r�test_countLengthyIntervalCountsz)LoopTests.test_countLengthyIntervalCounts�s������
�
���	3�
���)�)�)�4����
������
�
�8���������f�-�	�
�
�h��0�1��������x�/�'A�1�&E�F�	�
�
�h��o�&���������x��?�'J�A�&N�O�	�
�
�h��o�&���������h��/�'I�1�&M�Nrc�:�tj�}g}tjj|j�}||_d}d}||z}|j
|d��t|�D]}|j|��d�}|||g|z�z
}	|j|	�|j�}
|jt|	�dkD|	�d��|j|
|k\|
�d|���|j||�|�|jd	|�y
)a�
        L{task.LoopingCall.withCount} should never invoke its callable with a
        zero.  Specifically, if a L{task.LoopingCall} created with C{withCount}
        has its L{start <task.LoopingCall.start>} method invoked with a
        floating-point number which introduces decimal inaccuracy when
        multiplied or divided, such as "0.1", L{task.LoopingCall} will never
        invoke its callable with 0.  Also, the sum of all the values passed to
        its callable as the "count" will be an integer, the number of intervals
        that have elapsed.

        This is a regression test for a particularly tricky case to implement.
        rBr\F��nowc�"�d}|D]}||z
}�	|S)z�
            Make sure the result is more precise.
            On Python 3.11 or older this can be a float with ~ 0.00001
            in precision difference.
            See: https://github.com/python/cpython/issues/100425
            �r )�items�total�items   r�
sum_compatzALoopTests.test_withCountFloatingPointBoundary.<locals>.sum_compat�s&���E��
����
��
��Lrr�z should be greater than zeroz$ should be greater than or equal to rN)rr$r�r�rMrr��rangerOr&r4�absr%�assertNotIn)rr�accumulatorr:r��timespan�intervalrjr��epsilon�secondsValues           r�#test_withCountFloatingPointBoundaryz-LoopTests.test_withCountFloatingPointBoundary�s���
�
��������)�)�+�*<�*<�=����
�
�����e�#���
�
�8��
�'��u��	$�A��M�M�(�#�	$�
	��Z��
�U�(:�;�;��
�
�
�g���}�}���	
����G��s�*�w�i�7S�,T�U�	
����H�$��n�@��
�K�	
�
	
����K�0�%�8�����K�(rc�*���tj�}g���fd�}tjj|��|�_�jdd��}|j
dgdz�|j|�|jdgdz��y)zy
        L{task.LoopingCall.withCount} with interval set to 0 calls the
        countCallable with a count of 1.
        c�f���j|�t��dkDr�j�yy)NrF�rM�len�stop)�cntr��loops ��r�fooz1LoopTests.test_withCountIntervalZero.<locals>.foos,������s�#��;��!�#��	�	��$rrFr��r+N)	rr$r�r�rr�r��successResultOfr%)rrr��deferredr�r�s    @@r�test_withCountIntervalZeroz$LoopTests.test_withCountIntervalZero�s����
�
�
�����	�
���)�)�#�.����
��:�:�a�U�:�+��	�
�
�A�3��7�����X�&����!��q��+�.rc�����tj�}tj��g����fd�}tjj|��|�_�jdd��|jdgdz�|jdgdz��|jdgdz�|jdgdz���jd�|jdgdz�|jdgd	z��y)
z�
        L{task.LoopingCall.withCount} with interval set to 0 and a delayed
        call during the loop run will still call the countCallable 1 as if
        no delay occurred.
        c����j|�t��dk(r�St��dkDr�j�yy)Nr1rFr�)r�r�r�r�s ���rr�z6LoopTests.test_withCountIntervalZeroDelay.<locals>.foos>������s�#��;��1�$����;��!�#��	�	��$rrFr�r1r+NrFr�)rr$r�Deferredr�r�rr�r�r%�callback)rrr�r�r�r�s   @@@r�test_withCountIntervalZeroDelayz)LoopTests.test_withCountIntervalZeroDelays�����
�
����>�>�#����	����)�)�#�.����
��
�
�1�%�
� �
�
�
�A�3��7�����!��q��+�.�	�
�
�A�3��7�����!��q��+�.�	���$��
�
�
�A�3��7�����!��q��+�.rc��	�
��tj�}tj��
g�	d�d}d}d}||z}||z}|dz
}�	�
�fd�}tjj|�}||_|jdd��|jdg�|zz�|jdg�z�	�||_
�
jd	�|j|�|jdd|g�	�|jd|z�|jdd|dg�	�|jd|z�|jdd|ddg�	�y	)
z�
        L{task.LoopingCall.withCount} with interval set to 0 will still keep
        the time when last called so when the interval is reset.
        r1r��	r+c�H���j|�t���k(r�Syr�rMr�)r�r�r��stepsBeforeDelays ���rr�zILoopTests.test_withCountIntervalZeroDelayThenNonZeroInterval.<locals>.foobs)������s�#��;��#3�3���4rrFr�N)
rr$rr�r�r�rr�r�r%r�r�rO)rr�extraTimeAfterDelay�mutatedLoopInterval�durationOfDelay�skippedTime�expectedSkipCountr�r�r�r�r�s         @@@r�2test_withCountIntervalZeroDelayThenNonZeroIntervalz<LoopTests.test_withCountIntervalZeroDelayThenNonZeroInterval8sd���
�
�
����>�>�#������
 �� ����
*�O�;��(�+>�>��	�Q���	 �
���)�)�#�.����
��
�
�1�%�
� �	�
�
�A�3�*�-@�@�A�B����!��/�/��=�,��
����$��
�
�
�o�&����!�Q� 1�2�K�@�
�
�
�a�-�-�.����!�Q� 1�1�5�{�C�
�
�
�a�-�-�.����!�Q� 1�1�a�8�+�Frc�T���gd�}tj�}g�d�fd�	}t||ddd��}|jd�}g��fd�}|j	|�|j|�|j
t��d	d
t��fz��D]N\}}}	}
|j
|d�|j
|d�|j|	�|j
|
d��P|j�|j�d|�|j|j�y)
N�g�������?皙�����?r�c�0���j||||f�yrrL)rr.r(�d�Ls    �rr�z(LoopTests.testBasicFunction.<locals>.foo�s���
�H�H�a��A�q�\�"rrr.r��r�r�c�(���j|�yrrL�r~�	theResults �r�
saveResultz/LoopTests.testBasicFunction.<locals>.saveResult��������V�$rrEzgot %d iterations, not 3r)NN)
rr$r
r��addCallbackr�r%r��assertIsNoner��assertIsr?rn)
r�timingsrr��lc�Dr�rr.r(r�r�r�s
           @@r�testBasicFunctionzLoopTests.testBasicFunction�s���
#���
�
�����	#�!���S�#��
=���H�H�S�M���	�	%�	
�
�
�j�!�
�
�
�7������Q���$>�#�a�&��$J�K��	%�J�A�q�!�Q����Q��$����Q��$����a� ����Q��$�		%�	���	��
�
�i��l�B�'�	
������%rc���gd�}tj�}g}t||jd�}|j	dd��}g��fd�}|j|�|j
|�|jt|�ddt|�fz�|j�|j�d|�|j|j�y)	Nr�r�Fr�c�(���j|�yrrLr�s �rr�z.LoopTests.testDelayedStart.<locals>.saveResult�r�rr1zgot %d iterations, not 2r)
rr$r
rMr�r�r�r%r�r�r�r?rn)rr�rr�r�r�r�r�s       @r�testDelayedStartzLoopTests.testDelayedStart�s����"���
�
�����
 �����$�
7���H�H�S�e�H�$���	�	%�	
�
�
�j�!�
�
�
�7������Q���$>�#�a�&��$J�K�
���	��
�
�i��l�B�'�������%rc�r�tjd��}|jt|jd�y)Nc��yrr r rrr/z(LoopTests.testBadDelay.<locals>.<lambda>�r0r���)rr�rT�
ValueErrorr�)rr�s  r�testBadDelayzLoopTests.testBadDelay�s(��
�
�
�l�
+�����*�b�h�h��3rc����g��fd�}tj�}t||�}|j|d��|j	�|j��|j|j�y)Nc�(���jd�yrrL��rans�rr�z$LoopTests._stoppingTest.<locals>.foo������J�J�t�rFr�)rr$r
r�r�r?rn)rr^r�rr�r�s     @r�
_stoppingTestzLoopTests._stoppingTest�s_�����	��
�
���
 ���
,��
����E��"�
���	������������%rc�$�|jd�S)Nr�r��rs r�testStopAtOncezLoopTests.testStopAtOnce�s���!�!�!�$�$rc�$�|jd�S)NrBrrs r�testStoppingBeforeDelayedStartz(LoopTests.testStoppingBeforeDelayedStart�s���!�!�"�%�%rc�J��g��fd�}tj�}t||�}|jdd��|j	d�|j�|j	d�|j
�g�|j	d�|j
�dg�y)z8
        Test that L{LoopingCall} can be reset.
        c�(���jd�yrrLr�s�rr�z!LoopTests.test_reset.<locals>.foo�r�rr1Fr�r+N)rr$r
r�rOrbr%)rr�r(r�r�s    @r�
test_resetzLoopTests.test_reset�s������	�
�J�J�L��
 ��C�
(��
�������	�	�	�!��
���
�	�	�	�!������b�!�	�	�	�!������t�f�%rc	�n�|jttjtdd���d�y)zO
        L{LoopingCall.__repr__} includes the wrapped function's name.
        r+r1)�keyz6LoopingCall<None>(installReactor, *(1,), **{'key': 2})N)r%�reprrr�rrs r�test_reprFunctionzLoopTests.test_reprFunction�s,��	
�����!�!�.�!��;�<�D�	
rc�|�|jttjtj
��d�y)zR
        L{LoopingCall.__repr__} includes the wrapped method's full name.
        z:LoopingCall<None>(TestableLoopingCall.__init__, *(), **{})N)r%rrr�r
rrs r�test_reprMethodzLoopTests.test_reprMethod�s/��	
�����!�!�"5�">�">�?�@�H�	
rc�"�tjd��}|jd}|j|jg�}|jdt
|��|jt|dd�|j||dd�y)z8
        L{LoopingCall.deferred} is deprecated.
        c��yrr r rrr/z4LoopTests.test_deferredDeprecation.<locals>.<lambda>r0rz�twisted.internet.task.LoopingCall.deferred was deprecated in Twisted 16.0.0; please use the deferred returned by start() insteadr+r�category�messageN)rr�r��
flushWarnings�test_deferredDeprecationr%r��DeprecationWarning)rr�r�warningss    rrz"LoopTests.test_deferredDeprecation�s�������-���
�
�
B�	�
�%�%�t�'D�'D�&E�F������C��M�*����+�X�a�[��-D�E�����(�1�+�i�"8�9rN)rrrr�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrrr rrr�r��sr���
.�2-�h +�D8
�t'O�R@)�D/�4$/�LGG�R&&�P&�04�
&�%�&�&�&
�
�:rr�c�<�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
y	)
�ReactorLoopTestsc�~�d�}tj|d�}|j|jd�t�S)Nc��t|��r�rris rr�z)ReactorLoopTests.testFailure.<locals>.foos
����"�"r�barr��rr��
assertFailurer�r�rr�r�s   r�testFailurezReactorLoopTests.testFailures6��	#��
�
�c�5�
)���!�!�"�(�(�3�-��?�?rc����fd�}tj|d��|j�jd�t�S)Nc�:���j�t|��r)r�r)rjr�s �rr�z-ReactorLoopTests.testFailAndStop.<locals>.foos����G�G�I���"�"rrr�rrs  @r�testFailAndStopz ReactorLoopTests.testFailAndStops7���	#��
�
�c�5�
)���!�!�"�(�(�3�-��?�?rc�����g���fd�}tj|���jd�}��fd�}|j|�S)Nc�f���jd�t��dkDr�j�yy)Nr�r�)r�r�s��rr�z0ReactorLoopTests.testEveryIteration.<locals>.foo&s(����J�J�t���3�x�!�|����	�rrc�<���jt��d�y)N�)r%r�)�ignr�rs ��r�stoppedz4ReactorLoopTests.testEveryIteration.<locals>.stopped.s������S��X�q�)r)rr�r�r�)rr�r�r)r�r�s`   @@r�testEveryIterationz#ReactorLoopTests.testEveryIteration#sB�����	�
�
�
�c�
"���H�H�Q�K��	*��}�}�W�%�%rc����tj���fd�}tj|�|_|jjdd��t
jd|j���S)Nc�N���jtjd��y)Nz'This task also should never get called.)�errbackr�DefaultExceptionr�s�rr�z1ReactorLoopTests.testStopAtOnceLater.<locals>.foo8s���
�I�I��(�(�)R�S�
rr+Fr�r)	rr�rr��_lcr�rr3�!_callback_for_testStopAtOnceLater)rr�r�s  @r�testStopAtOnceLaterz$ReactorLoopTests.testStopAtOnceLater3s[���
�N�N���	�
�#�#�C�(��������q�e��$����!�T�C�C�Q�G��rc�z�|jj�tjd|jd�y)Nr�success)r/r�rr3r�)rr�s  rr0z2ReactorLoopTests._callback_for_testStopAtOnceLaterBs%�����
�
�����!�Q�Z�Z��3rc�����ddg}tj����fd�}t�|���jd��j	|�|j�j�y)N皙�����?g�������?c���tj�}|j�fd���jd|jd�|S)Nc�$���j�Sr)r�)�_r�s �rr/z@ReactorLoopTests.testWaitDeferred.<locals>.foo.<locals>.<lambda>Ns
���B�G�G�I�rr+)rr�r�r3r�)r�rr�s ��rr�z.ReactorLoopTests.testWaitDeferred.<locals>.fooLs5������ �A�
�M�M�-�.��O�O�A�q�z�z�4�0��Hr)rr$r
r�r�r?rn)rr�r�rr�s   @@r�testWaitDeferredz!ReactorLoopTests.testWaitDeferredFsU�����*���
�
���	�!���
,��
����
�
�
�
�7��������%rc���dg}tj���fd�}t�|�}|jd�}|j	|t
��j
|�|j�j�|S)N�333333�?c�z��tj�}�jd|jt	��|S)Nr;)rr�r3r-r)r�rs �rr�z4ReactorLoopTests.testFailurePropagation.<locals>.fooas*������ �A��O�O�C����M�O�<��Hrr+)	rr$r
r�rrr�r?rn)rr�r�r�r�rs     @r�testFailurePropagationz'ReactorLoopTests.testFailurePropagationWsj����%���
�
���	�
!���
,���H�H�Q�K�����1�m�,�
�
�
�7��������%��rc����tj�}tj��g���fd�}tjj|�}||_|jdd���|j�g�|jddg�|jt��d��jd�|jdg�|jt��d�|j�dd	g�y)
a?
        In the case that the function passed to L{LoopingCall.withCount}
        returns a deferred, which does not fire before the next interval
        elapses, the function should not be run again. And if a function call
        is skipped in this fashion, the appropriate count should be
        provided.
        c�H���j|�t��dk(r�Sy�Nr+r�)�
possibleCountr��deferredCountss ��r�countTrackerz=ReactorLoopTests.test_deferredWithCount.<locals>.countTrackerzs&����!�!�-�0��>�"�a�'���rr5Fr�g�������?r+Nr1rE)rr$rr�r�r�rr�r%r�r�r�)r�	testClockrCr�r�rBs    @@r�test_deferredWithCountz'ReactorLoopTests.test_deferredWithCountns�����J�J�L�	��N�N�����	��
�
�
'�
'��
5������H�H�S�e�H�$��	
�����,�	����S�z�"�����^�,�a�0�	
�
�
�4������u������^�,�a�0�	
����!�Q��0rN)rrrr r#r*r1r0r9r=rEr rrrrs,��@�@�&� 
�4�&�"�.*1rrc�(�eZdZdZd�Zd�Zd�Zd�Zy)�DeferLaterTestsz'
    Tests for L{task.deferLater}.
    c�P���g�t����fd�}tj�}tj|d|dd��}|j	|j
��|j
d�|j�g�|j
d�|j�dg�|S)	z�
        The L{Deferred} returned by L{task.deferLater} is called back after
        the specified delay with the result of the function passed in.
        c�.���j||f��SrrL)r�r�flag�resultss  ��r�callablez/DeferLaterTests.test_callback.<locals>.callable�s����N�N�C��:�&��KrrEr�r)rr1r+)r�r)�objectrr$�
deferLaterr�r�rOr%)rrLrr�rJrKs    @@r�
test_callbackzDeferLaterTests.test_callback�s����
���x��	��
�
����O�O�E�1�h��5�A��	�
�
�d�m�m�T�*�
�
�
�a������"�%�
�
�
�a������>�"2�3��rc��d�}tj�}tj|d|�}|jd�|j	|t
�S)z�
        The L{Deferred} returned by L{task.deferLater} is errbacked if the
        supplied function raises an exception.
        c��t��rrr rrrLz.DeferLaterTests.test_errback.<locals>.callable�s
���/�!rr+)rr$rNrOrr)rrLrr�s    r�test_errbackzDeferLaterTests.test_errback�sE��	"��
�
����O�O�E�1�h�/��
�
�
�a���!�!�!�]�3�3rc�����g�tj��tj�d�jd�}|j	����fd�}�j|tj�|j|�|S)z�
        The L{Deferred} returned by L{task.deferLater} can be
        cancelled to prevent the call from actually being performed.
        r+Nc�h���jg�j���j��yr)r%rlr?)�ignored�calledrrs ���r�cbCancelledz0DeferLaterTests.test_cancel.<locals>.cbCancelled�s*������R��!6�!6�!8�9����V�$r)	rr$rNrMr>rr�CancelledErrorr�)rr�rWrVrs`  @@r�test_cancelzDeferLaterTests.test_cancel�sd���
���
�
����O�O�E�1�f�m�m�T�:��	���
�	%�	
���1�e�2�2�3�	�
�
�k�"��rc���tj�}tj|d�}|j|�|j	d�|jd|j
|��y)z�
        The L{Deferred} returned by L{task.deferLater} fires with C{None}
        when no callback function is passed.
        rwN)rr$rN�assertNoResultrOr�r�)rrr�s   r�test_noCallbackzDeferLaterTests.test_noCallback�sR��
�
�
����O�O�E�3�'�����A��
�
�
�c���
�
�d�D�0�0��3�4rN)rrrr�rOrRrYr\r rrrGrG�s����*4��(
5rrGc�*�eZdZd�Zd�Zd�Zd�Zd�Zy)�_FakeReactorc��d|_tj�|_|jj|_|jj
|_|jj|_g|_ggd�|_y)NF��before�during)	�_runningrr$�_clockr3r&rl�_whenRunning�_shutdownTriggersrs rrz_FakeReactor.__init__�s_����
��j�j�l������.�.����{�{�*�*���#�{�{�:�:������,.�"�!=��rc�j�|j�	||i|��y|jj|||f�yr)rerM)rrL�args�kwargss    r�callWhenRunningz_FakeReactor.callWhenRunning�s6�����$��d�%�f�%����$�$�h��f�%=�>rc�^�|dvsJ�|dk(sJ�|j|j||f�y)Nr`�shutdown)rfrM)r�phase�eventrLrhs     r�addSystemEventTriggerz"_FakeReactor.addSystemEventTrigger�s=���,�,�,�,��
�"�"�"����u�%�,�,�h��-=�>rc��d|_|j}d|_|D]\}}}||i|���|jrg|j�}|std��|jj|dj
�|j�z
�|jr�g|j}d|_|d|dzD]
\}}||��y)z�
        Call timed events until there are no more or the reactor is stopped.

        @raise RuntimeError: When no timed events are left and the reactor is
            still running.
        TNzNo DelayedCalls leftrrarb)	rcrerl�RuntimeErrorrdrOr7r&rf)r�whenRunningrLrhrirn�shutdownTriggers�triggers        r�runz_FakeReactor.run�s�����
��'�'�� ���&1�	&�"�H�d�F��d�%�f�%�	&��m�m��(�(�*�E��"�#9�:�:��K�K����a�� 0� 0� 2�T�\�\�^� C�D�	�m�m�
 �1�1��!%���-�h�7�:J�8�:T�T�	�M�G�T��T�N�	rc�R�|jstj��d|_y)z#
        Stop the reactor.
        FN)rcr�ReactorNotRunningrs rr�z_FakeReactor.stops!���}�}��)�)�+�+���
rN)rrrrrjrorur�r rrr^r^�s��>�?�?�
�,rr^c�R�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zy
)�
ReactTestsz3
    Tests for L{twisted.internet.task.react}.
    c���g��fd�}t�}|jttj||��}|jd|j�|j�dg�|j|j�d�y)��
        L{task.react} runs the reactor until the L{Deferred} returned by the
        function it is passed is called back, then stops it.
        c���tj�}|jd�jd�|jd|jd�|S�Nr+Tr1�rr�r3rMr��r�finished�
timePasseds  �r�mainz4ReactTests.test_runsUntilAsyncCallback.<locals>.main$sH����~�~�'�H��G���a��!2�!2�D�9��G���a��!2�!2�D�9��Or��_reactorrTr1N�r^rT�
SystemExitr�reactr%�coder&�rr��r�	exitErrorr�s    @r�test_runsUntilAsyncCallbackz&ReactTests.test_runsUntilAsyncCallbacksq���
�
�	�
�N���%�%�j�$�*�*�d�Q�%�O�	�����I�N�N�+�����d�V�,��������a�(rc���d�}t�}|jttj||��}|jd|j�|j|j�d�y)��
        L{task.react} returns quickly if the L{Deferred} returned by the
        function it is passed has already been called back at the time it is
        returned.
        c�,�tjd�Sr�r�succeed�rs rr�z3ReactTests.test_runsUntilSyncCallback.<locals>.main7s���=�=��&�&rr�rNr��rr�r�r�s    r�test_runsUntilSyncCallbackz%ReactTests.test_runsUntilSyncCallback0sW��	'�
�N���%�%�j�$�*�*�d�Q�%�O�	�����I�N�N�+��������a�(rc� ��Gd�dt���fd�}t�}|jttj
||��}|j
d|j�|j��}|j
t|�d�y)��
        L{task.react} runs the reactor until the L{defer.Deferred} returned by
        the function it is passed is errbacked, then it stops the reactor and
        reports the error.
        c��eZdZy)�@ReactTests.test_runsUntilAsyncErrback.<locals>.ExpectedExceptionNrr rr�ExpectedExceptionr�F���rr�c�v��tj�}|jd|j���|Sr@�rr�r3r-�rr�r�s  �rr�z3ReactTests.test_runsUntilAsyncErrback.<locals>.mainIs2����~�~�'�H��G���a��!1�!1�3D�3F�G��Orr�r+N�
�	Exceptionr^rTr�rr�r%r��flushLoggedErrorsr��rr�r�r��errorsr�s     @r�test_runsUntilAsyncErrbackz%ReactTests.test_runsUntilAsyncErrback?ss���	�	�	�	�

�N���%�%�j�$�*�*�d�Q�%�O�	�����I�N�N�+��'�'�(9�:������V��a�(rc�`��Gd�dt���fd�}t�}|jttj
||��}|j
d|j�|j
|j�d�|j��}|j
t|�d�y)��
        L{task.react} returns quickly if the L{defer.Deferred} returned by the
        function it is passed has already been errbacked at the time it is
        returned.
        c��eZdZy)�?ReactTests.test_runsUntilSyncErrback.<locals>.ExpectedExceptionNrr rrr�r�]r�rr�c�8��tj���Sr�r�fail�rr�s �rr�z2ReactTests.test_runsUntilSyncErrback.<locals>.main`s����:�:�/�1�2�2rr�r+rN�r�r^rTr�rr�r%r�r&r�r�r�s     @r�test_runsUntilSyncErrbackz$ReactTests.test_runsUntilSyncErrbackVs����	�	�	�	3�
�N���%�%�j�$�*�*�d�Q�%�O�	�����I�N�N�+��������a�(��'�'�(9�:������V��a�(rc���d�}t�}|jttj||��}|j|j
�d�|jd|j�y)��
        L{task.react} doesn't try to stop the reactor if the L{defer.Deferred}
        the function it is passed is called back after the reactor has already
        been stopped.
        c��|jd|j�tj�}|jdd|j
d�|S�Nr+rbrl�r3r�rr�ror��rr�s  rr�z0ReactTests.test_singleStopCallback.<locals>.mainqsF���G���a����.��~�~�'�H�)�G�)�)�(�J��@Q�@Q�SW�X��Orr�r+rN�r^rTr�rr�r%r&r�r�s    r�test_singleStopCallbackz"ReactTests.test_singleStopCallbackjsW��	�
�N���%�%�j�$�*�*�d�Q�%�O�	��������a�(�����I�N�N�+rc�`��Gd�dt���fd�}t�}|jttj
||��}|j
d|j�|j
|j�d�|j��}|j
t|�d�y)��
        L{task.react} doesn't try to stop the reactor if the L{defer.Deferred}
        the function it is passed is errbacked after the reactor has already
        been stopped.
        c��eZdZy)�<ReactTests.test_singleStopErrback.<locals>.ExpectedExceptionNrr rrr�r��r�rr�c���|jd|j�tj�}|jdd|j
���|Sr��r3r�rr�ror-r�s  �rr�z/ReactTests.test_singleStopErrback.<locals>.main�sO����G���a����.��~�~�'�H�)�G�)�)��*�h�&6�&6�8I�8K�
��Orr�r+Nr�r�s     @r�test_singleStopErrbackz!ReactTests.test_singleStopErrback}s����	�	�	�	�
�N���%�%�j�$�*�*�d�Q�%�O�	�����I�N�N�+��������a�(��'�'�(9�:������V��a�(rc����g��fd�}t�}|jttj|gd�|��}|jd|j�|j�gd��y)��
        L{task.react} passes the elements of the list it is passed as
        positional arguments to the function it is passed.
        c�V���j|||f�tjd�Sr��extendrr��rrj�y�zrhs    �rr�z'ReactTests.test_arguments.<locals>.main�s$����K�K��A�q�	�"��=�=��&�&r�r+r1rEr�rN�r^rTr�rr�r%r��rr�r�r�rhs    @r�test_argumentszReactTests.test_arguments�sb���
��	'�
�N���%�%���
�
�D�)�a�&�
�	�	
����I�N�N�+�����y�)rc�4���fd�}t�}t�5t|��jtt
j|g�}�jd|j�ddd��j|�j�y#1swY�&xYw)�p
        L{twisted.internet.reactor} is used if no reactor argument is passed to
        L{task.react}.
        c�<��|�_tjd�Sr��
passedReactorrr��rrs �rr�z,ReactTests.test_defaultReactor.<locals>.main�s���!(�D���=�=��&�&rrN�r^r	rrTr�rr�r%r�r�r��rr�rr�s`   r�test_defaultReactorzReactTests.test_defaultReactor�sw���	'��.��
�[�	0��7�#��)�)�*�d�j�j�$��K�I����Q�	���/�	0�	
�
�
�g�t�1�1�2�		0�	0���AB�Bc��d�}t�}|jttj|g|��}|jd|j�y)��
        L{task.react} forwards the exit code specified by the C{SystemExit}
        error returned by the passed function, if any.
        c�>�tjtd��S�N��rr�r�r�s rr�z1ReactTests.test_exitWithDefinedCode.<locals>.main�s���:�:�j��n�-�-rr�r�Nr�r�s    r�test_exitWithDefinedCodez#ReactTests.test_exitWithDefinedCode�sD��	.�
�N���%�%�j�$�*�*�d�B�QR�%�S�	�����Y�^�^�,rc��d�}t�}|jttj|g|��}|jd|j�y)�w
        L{task.react} handles when the reactor is stopped just before the
        returned L{Deferred} fires.
        c�b���tj����fd�}�j|��S)Nc�J���j��jd�yr�r�r��r�rs��rr�z;ReactTests.test_synchronousStop.<locals>.main.<locals>.stop�����������
�
�4� r�rr�rj�rr�r�s` @rr�z-ReactTests.test_synchronousStop.<locals>.main�s+������ �A�
!�
$�G�#�#�D�)��Hrr�rNr�r�s    r�test_synchronousStopzReactTests.test_synchronousStop�sD��	�
�N���%�%�j�$�*�*�d�B�QR�%�S�	�����I�N�N�+rc��d�}t�}|jttj|g|��}|jd|j�y)�v
        L{task.react} handles when the reactor is stopped and the
        returned L{Deferred} doesn't fire.
        c�d�|jd|j�tj�Sr@�r3r�rr�r�s rr�z.ReactTests.test_asynchronousStop.<locals>.main�s%���G���a����.��>�>�#�#rr�rNr�r�s    r�test_asynchronousStopz ReactTests.test_asynchronousStop�sD��	$�
�N���%�%�j�$�*�*�d�B�QR�%�S�	�����I�N�N�+rN�rrrr�r�r�r�r�r�r�r�r�r�r�r�r rrryry�>���)�&
)�)�.)�(,�&)�6*�$3�"-�,�(,rryc�R�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zy
)�ReactCoroutineFunctionTestszP
    Tests for L{twisted.internet.task.react} with an C{async def} argument
    c���g��fd�}t�}|jttj||��}|jd|j�|j�dg�|j|j�d�y)r{c����K�tj�}|jd�jd�|jd|jd�|�d{���S7��wr}r~rs  �rr�zEReactCoroutineFunctionTests.test_runsUntilAsyncCallback.<locals>.main�sQ������~�~�'�H��G���a��!2�!2�D�9��G���a��!2�!2�D�9�!�>�!�>�s�AA �A�A r�rTr1Nr�r�s    @rr�z7ReactCoroutineFunctionTests.test_runsUntilAsyncCallback�sq���
�
�	"�
�N���%�%�j�$�*�*�d�Q�%�O�	�����I�N�N�+�����d�V�,��������a�(rc���d�}t�}|jttj||��}|jd|j�|j|j�d�y)r�c��HK�tjd��d{���S7��wrr�r�s rr�zDReactCoroutineFunctionTests.test_runsUntilSyncCallback.<locals>.main
s�������t�,�,�,�,�s�"� �"r�rNr�r�s    rr�z6ReactCoroutineFunctionTests.test_runsUntilSyncCallbacksW��	-�
�N���%�%�j�$�*�*�d�Q�%�O�	�����I�N�N�+��������a�(rc� ��Gd�dt���fd�}t�}|jttj
||��}|j
d|j�|j��}|j
t|�d�y)r�c��eZdZy)�QReactCoroutineFunctionTests.test_runsUntilAsyncErrback.<locals>.ExpectedExceptionNrr rrr�r�r�rr�c���K�tj�}|jd|j���|�d{���S7��wr@r�r�s  �rr�zDReactCoroutineFunctionTests.test_runsUntilAsyncErrback.<locals>.mains;������~�~�'�H��G���a��!1�!1�3D�3F�G�!�>�!�>�s�=A�A�Ar�r+Nr�r�s     @rr�z6ReactCoroutineFunctionTests.test_runsUntilAsyncErrbackss���	�	�	�	"�

�N���%�%�j�$�*�*�d�Q�%�O�	�����I�N�N�+��'�'�(9�:������V��a�(rc�`��Gd�dt���fd�}t�}|jttj
||��}|j
d|j�|j
|j�d�|j��}|j
t|�d�y)r�c��eZdZy)�PReactCoroutineFunctionTests.test_runsUntilSyncErrback.<locals>.ExpectedExceptionNrr rrr�r�0r�rr�c��T�K�tj����d{���S7��wrr�r�s �rr�zCReactCoroutineFunctionTests.test_runsUntilSyncErrback.<locals>.main3s ��������$5�$7�8�8�8�8�s�(�&�(r�r+rNr�r�s     @rr�z5ReactCoroutineFunctionTests.test_runsUntilSyncErrback)s����	�	�	�	9�
�N���%�%�j�$�*�*�d�Q�%�O�	�����I�N�N�+��������a�(��'�'�(9�:������V��a�(rc���d�}t�}|jttj||��}|j|j
�d�|jd|j�y)r�c���K�|jd|j�tj�}|jdd|j
d�|�d{���S7��wr�r�r�s  rr�zAReactCoroutineFunctionTests.test_singleStopCallback.<locals>.mainDsO�����G���a����.��~�~�'�H�)�G�)�)�(�J��@Q�@Q�SW�X�!�>�!�>�s�AA�A�Ar�r+rNr�r�s    rr�z3ReactCoroutineFunctionTests.test_singleStopCallback=sW��	"�
�N���%�%�j�$�*�*�d�Q�%�O�	��������a�(�����I�N�N�+rc�`��Gd�dt���fd�}t�}|jttj
||��}|j
d|j�|j
|j�d�|j��}|j
t|�d�y)r�c��eZdZy)�MReactCoroutineFunctionTests.test_singleStopErrback.<locals>.ExpectedExceptionNrr rrr�r�Wr�rr�c����K�|jd|j�tj�}|jdd|j
���|�d{���S7��wr�r�r�s  �rr�z@ReactCoroutineFunctionTests.test_singleStopErrback.<locals>.mainZsX������G���a����.��~�~�'�H�)�G�)�)��*�h�&6�&6�8I�8K�
�"�>�!�>�s�AA%�A#�A%r�r+Nr�r�s     @rr�z2ReactCoroutineFunctionTests.test_singleStopErrbackPs����	�	�	�	"�
�N���%�%�j�$�*�*�d�Q�%�O�	�����I�N�N�+��������a�(��'�'�(9�:������V��a�(rc����g��fd�}t�}|jttj|gd�|��}|jd|j�|j�gd��y)r�c��r�K��j|||f�tjd��d{���S7��wrr�r�s    �rr�z8ReactCoroutineFunctionTests.test_arguments.<locals>.mainrs.������K�K��A�q�	�"����t�,�,�,�,�s�-7�5�7r�r�rNr�r�s    @rr�z*ReactCoroutineFunctionTests.test_argumentsksb���
��	-�
�N���%�%���
�
�D�)�a�&�
�	�	
����I�N�N�+�����y�)rc�4���fd�}t�}t�5t|��jtt
j|g�}�jd|j�ddd��j|�j�y#1swY�&xYw)r�c��X�K�|�_tjd��d{���S7��wrr�r�s �rr�z=ReactCoroutineFunctionTests.test_defaultReactor.<locals>.main�s$�����!(�D�����t�,�,�,�,�s� *�(�*rNr�r�s`   rr�z/ReactCoroutineFunctionTests.test_defaultReactor}sw���	-��.��
�[�	0��7�#��)�)�*�d�j�j�$��K�I����Q�	���/�	0�	
�
�
�g�t�1�1�2�		0�	0�r�c��d�}t�}|jttj|g|��}|jd|j�y)r�c��ZK�tjtd���d{���S7��wr�r�r�s rr�zBReactCoroutineFunctionTests.test_exitWithDefinedCode.<locals>.main�s�������J�r�N�3�3�3�3�s�"+�)�+r�r�Nr�r�s    rr�z4ReactCoroutineFunctionTests.test_exitWithDefinedCode�sD��	4�
�N���%�%�j�$�*�*�d�B�QR�%�S�	�����Y�^�^�,rc��d�}t�}|jttj|g|��}|jd|j�y)r�c��~��K�tj����fd�}�j|���d{���S7��w)Nc�J���j��jd�yrr�r�s��rr�zLReactCoroutineFunctionTests.test_synchronousStop.<locals>.main.<locals>.stop�r�rr�r�s` @rr�z>ReactCoroutineFunctionTests.test_synchronousStop.<locals>.main�s3�������� �A�
!�
$�G�#�#�D�)��7�N�7�s�2=�;�=r�rNr�r�s    rr�z0ReactCoroutineFunctionTests.test_synchronousStop�sD��	�
�N���%�%�j�$�*�*�d�B�QR�%�S�	�����I�N�N�+rc��d�}t�}|jttj|g|��}|jd|j�y)r�c��K�|jd|j�tj��d{���S7��wr@r�r�s rr�z?ReactCoroutineFunctionTests.test_asynchronousStop.<locals>.main�s/�����G���a����.����)�)�)�)�s�5>�<�>r�rNr�r�s    rr�z1ReactCoroutineFunctionTests.test_asynchronousStop�sD��	*�
�N���%�%�j�$�*�*�d�B�QR�%�S�	�����I�N�N�+rNr�r rrr�r��r�rr�N)r��twisted.internetrrrrr�twisted.internet.mainr�#twisted.internet.test.modulehelpersr	�
twisted.trialr
r$�twisted.pythonrr�r
r�r�TestCaser"r�rrGr^�SynchronousTestCaseryr�r rr�<module>rs����
E�D�0�9�"�	
�
�
��"��$�*�*��	�I�	�O+��"�"�O+�d^:��!�!�^:�BG1�x�(�(�G1�TF5�h�'�'�F5�R1�1�hP,��-�-�P,�fP,�(�">�">�P,r

Zerion Mini Shell 1.0