Ë
    ojç¾  ã                   ó¼  — d Z ddlmZmZmZmZmZ ddlmZ ddl	m
Z
 ddlmZ ej                  ZddlmZ  G d„ dej                   «      Z G d	„ d
e«      Z G d„ dej(                  «      Z G d„ dej(                  «      Z G d„ dej(                  «      Z G d„ dej(                  «      Z G d„ d«      Z G d„ dej4                  «      Z G d„ dej4                  «      Zy)z%
Tests for L{twisted.internet.task}.
é    )ÚdeferÚerrorÚ
interfacesÚreactorÚtask)ÚinstallReactor)Ú	NoReactor)Úunittest)Úfailurec                   ó   ‡ — e Zd Zˆ fd„Zˆ xZS )ÚTestableLoopingCallc                 ó2   •— t        ‰| �  |i |¤Ž || _        y ©N)ÚsuperÚ__init__Úclock)Úselfr   ÚaÚkwÚ	__class__s       €ú8/usr/lib/python3/dist-packages/twisted/test/test_task.pyr   zTestableLoopingCall.__init__   s   ø€ Ü‰Ñ˜!Ð"˜rÒ"Øˆ�
ó    )Ú__name__Ú
__module__Ú__qualname__r   Ú__classcell__)r   s   @r   r   r      s   ø„ ÷ð r   r   c                   ó   — e Zd Zy)ÚTestExceptionN©r   r   r   © r   r   r   r      s   „ Ør   r   c                   ój   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zd
„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zy)Ú
ClockTestsz<
    Test the non-wallclock based clock implementation.
    c                 ól   — t        j                  «       }| j                  |j                  «       d«       y)zV
        Test that the C{seconds} method of the fake clock returns fake time.
        r   N)r   ÚClockÚassertEqualÚseconds©r   Úcs     r   ÚtestSecondszClockTests.testSeconds#   s%   € ô �J‰J‹LˆØ×Ñ˜Ÿ™› aÕ(r   c                 ó2  — t        j                  «       }|j                  dd„ dd¬«      }| j                  t        j
                  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                  ó   — y r   r    ©r   Úbs     r   ú<lambda>z*ClockTests.testCallLater.<locals>.<lambda>0   ó   � r   é   ©r.   N)
r   r$   Ú	callLaterÚ
assertTruer   ÚIDelayedCallÚ
providedByr%   ÚgetTimeÚactive©r   r(   Úcalls      r   ÚtestCallLaterzClockTests.testCallLater*   sk   € ô
 �J‰J‹LˆØ�{‰{˜1Ñ/°°aˆ{Ó8ˆØ�‰œ
×/Ñ/×:Ñ:¸4Ó@ÔAØ×Ñ˜Ÿ™›¨Ô+Ø�‰˜Ÿ™›Õ&r   c                 ó¶   — t        j                  «       }|j                  dd„ dd¬«      }|j                  «        | j	                  |j                  «       «       y)z3
        Test that calls can be cancelled.
        r+   c                  ó   — y r   r    r-   s     r   r/   z3ClockTests.testCallLaterCancelled.<locals>.<lambda>:   r0   r   r1   r2   N)r   r$   r3   ÚcancelÚassertFalser8   r9   s      r   ÚtestCallLaterCancelledz!ClockTests.testCallLaterCancelled5   sC   € ô �J‰J‹LˆØ�{‰{˜1Ñ/°°aˆ{Ó8ˆØ�‰ŒØ×Ñ˜Ÿ™›Õ'r   c                 óª   — t        j                  «       }|j                  dd„ dd¬«      }|j                  dd„ dd¬«      }| j                  ||u «       y	)
z[
        Test that the DelayedCall returned is not one previously
        created.
        é
   c                  ó   — y r   r    r-   s     r   r/   z3ClockTests.test_callLaterOrdering.<locals>.<lambda>D   r0   r   r+   r1   r2   c                  ó   — y r   r    r-   s     r   r/   z3ClockTests.test_callLaterOrdering.<locals>.<lambda>E   r0   r   é   é   N)r   r$   r3   r?   )r   r(   Úcall1Úcall2s       r   Útest_callLaterOrderingz!ClockTests.test_callLaterOrdering>   sO   € ô
 �J‰J‹LˆØ—‘˜BÑ 1°1¸�Ó:ˆØ—‘˜AÑ0°!°q�Ó9ˆØ×Ñ˜ %˜Õ(r   c                 ó(  ‡— g Št        j                  «       }|j                  dˆfd„«      }|j                  d«       | j	                  ‰g «       |j                  d«       | j	                  ‰dg«       | j                  |j                  «       «       y)zE
        Test that advancing the clock will fire some calls.
        r1   c                  ó&   •— ‰ j                  d «      S r   ©Úappend)Úeventss   €r   r/   z(ClockTests.testAdvance.<locals>.<lambda>N   s   ø€  f§m¡m°DÓ&9€ r   r+   N)r   r$   r3   Úadvancer%   r?   r8   ©r   r(   r:   rN   s      @r   ÚtestAdvancezClockTests.testAdvanceH   sr   ø€ ð ˆÜ�J‰J‹LˆØ�{‰{˜1Ó9Ó:ˆØ	�	‰	�!ŒØ×Ñ˜ Ô$Ø	�	‰	�!ŒØ×Ñ˜ $ Ô(Ø×Ñ˜Ÿ™›Õ'r   c                 ó‚   ‡ ‡— t        j                  «       }ˆˆ fd„}|j                  d|«      Š|j                  d«       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   •— ‰j                  t        j                  ‰ j                  «       y r   )ÚassertRaisesr   ÚAlreadyCalledr>   )r:   r   s   €€r   Úcbz(ClockTests.testAdvanceCancel.<locals>.cb_   s   ø€ Ø×Ñœe×1Ñ1°4·;±;Õ?r   r+   N)r   r$   r3   rO   )r   r(   rV   r:   s   `  @r   ÚtestAdvanceCancelzClockTests.testAdvanceCancelU   s3   ù€ ô �J‰J‹Lˆõ	@ð �{‰{˜1˜bÓ!ˆØ	�	‰	�!�r   c                 óR  ‡— g Št        j                  «       }|j                  dˆfd„dd¬«      }|j                  d«       | j	                  |j                  «       d«       |j                  d«       | j	                  ‰g «       |j                  d«       | j	                  ‰dg«       y)	z1
        Test that calls can be delayed.
        r+   c                 ó*   •— ‰j                  | |f«      S r   rL   ©r   r.   rN   s     €r   r/   z1ClockTests.testCallLaterDelayed.<locals>.<lambda>k   ó   ø€ ¨6¯=©=¸!¸Q¸Ó+@€ r   r1   r2   g      ø?ç      ð?©r+   r1   N)r   r$   r3   Údelayr%   r7   rO   rP   s      @r   ÚtestCallLaterDelayedzClockTests.testCallLaterDelayede   s…   ø€ ð ˆÜ�J‰J‹LˆØ�{‰{˜1Ó@À!Àqˆ{ÓIˆØ�
‰
�1ŒØ×Ñ˜Ÿ™›¨Ô+Ø	�	‰	�#ŒØ×Ñ˜ Ô$Ø	�	‰	�#ŒØ×Ñ˜ & Õ*r   c                 ót  ‡— g Št        j                  «       }|j                  dˆfd„dd¬«      }|j                  d«       |j	                  d«       | j                  |j                  «       d«       |j                  d«       | j                  ‰g «       |j                  d«       | j                  ‰dg«       y)	zL
        Test that calls can have their time reset to a later time.
        r1   c                 ó*   •— ‰j                  | |f«      S r   rL   rZ   s     €r   r/   z4ClockTests.testCallLaterResetLater.<locals>.<lambda>y   r[   r   r+   r2   rE   rF   r]   N)r   r$   r3   rO   Úresetr%   r7   rP   s      @r   ÚtestCallLaterResetLaterz"ClockTests.testCallLaterResetLaters   s�   ø€ ð ˆÜ�J‰J‹LˆØ�{‰{˜1Ó@À!Àqˆ{ÓIˆØ	�	‰	�!ŒØ�
‰
�1ŒØ×Ñ˜Ÿ™›¨Ô+Ø	�	‰	�!ŒØ×Ñ˜ Ô$Ø	�	‰	�!ŒØ×Ñ˜ & Õ*r   c                 ó  ‡— g Št        j                  «       }|j                  dˆfd„dd¬«      }|j                  d«       | j	                  |j                  «       d«       |j                  d«       | j	                  ‰dg«       y)	zO
        Test that calls can have their time reset to an earlier time.
        rF   c                 ó*   •— ‰j                  | |f«      S r   rL   rZ   s     €r   r/   z5ClockTests.testCallLaterResetSooner.<locals>.<lambda>ˆ   r[   r   r+   r1   r2   rE   r]   N)r   r$   r3   rb   r%   r7   rO   rP   s      @r   ÚtestCallLaterResetSoonerz#ClockTests.testCallLaterResetSooner‚   sj   ø€ ð ˆÜ�J‰J‹LˆØ�{‰{˜1Ó@À!Àqˆ{ÓIˆØ�
‰
�1ŒØ×Ñ˜Ÿ™›¨Ô+Ø	�	‰	�!ŒØ×Ñ˜ & Õ*r   c                 óÒ   — t        j                  «       }|j                  dd„ «      }|j                  dd„ «      }|j                  «       }| j	                  ||ht        |«      «       y)zB
        Test that we can get a list of all delayed calls
        r+   c                  ó   — y r   r    ©Úxs    r   r/   z1ClockTests.test_getDelayedCalls.<locals>.<lambda>“   r0   r   r1   c                  ó   — y r   r    ri   s    r   r/   z1ClockTests.test_getDelayedCalls.<locals>.<lambda>”   r0   r   N)r   r$   r3   ÚgetDelayedCallsr%   Úset)r   r(   r:   rH   Úcallss        r   Útest_getDelayedCallszClockTests.test_getDelayedCallsŽ   sU   € ô �J‰J‹LˆØ�{‰{˜1™nÓ-ˆØ—‘˜A™~Ó.ˆà×!Ñ!Ó#ˆà×Ñ˜$ ˜¬¨E«
Õ3r   c                 ól   — t        j                  «       }| j                  |j                  «       g «       y)zk
        Test that we get an empty list from getDelayedCalls on a newly
        constructed Clock.
        N)r   r$   r%   rl   r'   s     r   Útest_getDelayedCallsEmptyz$ClockTests.test_getDelayedCallsEmptyš   s(   € ô
 �J‰J‹LˆØ×Ñ˜×*Ñ*Ó,¨bÕ1r   c                 óŠ   — t        j                  «       }| j                  t        j                  j                  |«      d«       y )Nz#Clock does not provide IReactorTime)r   r$   r4   r   ÚIReactorTimer6   r'   s     r   Útest_providesIReactorTimez$ClockTests.test_providesIReactorTime¢   s0   € Ü�J‰J‹LˆØ�‰Ü×#Ñ#×.Ñ.¨qÓ1Ð3Xõ	
r   c                 ó  ‡‡— g Šddg}t        j                  «       Šˆˆfd„}‰j                  d|d«      }|j                  d«       ‰j                  d|d«       ‰j	                  d	gd
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«      S r   ©rM   r&   ©Únr   Úresults    €€r   r/   z<ClockTests.test_callLaterKeepsCallsOrdered.<locals>.<lambda>·   ó   ø€ ˜FŸM™M¨1¨e¯m©m«oÐ*>Ó?€ r   r\   r   ry   rw   r.   r+   rE   N©r   r$   r3   rb   Úpumpr%   ©r   ÚexpectedÚlogtimeÚcall_ar   r~   s       @@r   Útest_callLaterKeepsCallsOrderedz*ClockTests.test_callLaterKeepsCallsOrdered¨   st   ù€ ð ˆØ 
Ð+ˆÜ—
‘
“ˆÜ?ˆà—‘  g¨sÓ3ˆØ�‰�SÔØ�‰˜˜W cÔ*à�
‰
�A�3˜‘7ÔØ×Ñ˜ Õ*r   c                 ó  ‡‡— g Šddg}t        j                  «       Šˆˆfd„}‰j                  d|d«      }‰j                  d|d«       |j                  d«       ‰j	                  d	gd
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".
        rv   rx   c                 óF   •— ‰j                  | ‰j                  «       f«      S r   r{   r|   s    €€r   r/   zAClockTests.test_callLaterResetKeepsCallsOrdered.<locals>.<lambda>Ï   r   r   r\   r   rw   r.   ry   r+   rE   Nr€   r‚   s       @@r   Ú$test_callLaterResetKeepsCallsOrderedz/ClockTests.test_callLaterResetKeepsCallsOrderedÀ   st   ù€ ð ˆØ 
Ð+ˆÜ—
‘
“ˆÜ?ˆà—‘  g¨sÓ3ˆØ�‰˜˜W cÔ*Ø�‰�SÔà�
‰
�A�3˜‘7ÔØ×Ñ˜ Õ*r   c                 ó  ‡‡‡— g Šddg}t        j                  «       Šˆˆfd„}‰j                  d|d«      Šˆfd„}‰j                  d|«       ‰j                  d|d	«       ‰j                  d
gdz  «       | 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«      S r   r{   r|   s    €€r   r/   zKClockTests.test_callLaterResetInsideCallKeepsCallsOrdered.<locals>.<lambda>â   r   r   rw   r.   c                  ó(   •— ‰ j                  d«       y )Nry   )rb   )Úcall_bs   €r   r   zDClockTests.test_callLaterResetInsideCallKeepsCallsOrdered.<locals>.aæ   s   ø€ Ø�L‰L˜Õr   r\   ry   r(   ç      à?rB   N)r   r$   r3   r�   r%   )r   rƒ   r„   r   r�   r   r~   s       @@@r   Ú.test_callLaterResetInsideCallKeepsCallsOrderedz9ClockTests.test_callLaterResetInsideCallKeepsCallsOrderedØ   s}   ú€ ð ˆØ 
Ð+ˆÜ—
‘
“ˆÜ?ˆà—‘  g¨sÓ3ˆô	ð 	�‰˜˜QÔØ�‰˜˜W cÔ*à�
‰
�C�5˜2‘:ÔØ×Ñ˜ Õ*r   N)r   r   r   Ú__doc__r)   r;   r@   rI   rQ   rW   r_   rc   rf   ro   rq   rt   r†   r‰   r�   r    r   r   r"   r"      sR   „ ñò)ò	'ò(ò)ò(òò +ò+ò
+ò
4ò2ò
ò+ò0+ó0+r   r"   c                   ó‚   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zd
„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zy)Ú	LoopTestsz[
    Tests for L{task.LoopingCall} based on a fake L{IReactorTime}
    implementation.
    c                 óp   — t        j                  d„ «      }| j                  |j                  t        «       y)zG
        L{LoopingCall}'s default clock should be the reactor.
        c                   ó   — y r   r    r    r   r   r/   z-LoopTests.test_defaultClock.<locals>.<lambda>ú   r0   r   N)r   ÚLoopingCallr%   r   r   )r   r:   s     r   Útest_defaultClockzLoopTests.test_defaultClockö   s(   € ô ×Ñ¡Ó-ˆØ×Ñ˜Ÿ™¤WÕ-r   c                 óº  ‡‡‡— g ŠdŠt        j                  «       Šˆˆˆfd„}t        j                  |«      }‰|_        dŠ|j	                  d«       | j                  ‰dg«       | j                  ‰j                  «       ‰«       ‰j                  d«       | j                  ‰dg«       dŠ‰j                  d«       | j                  ‰ddg«       | j                  ‰j                  «       d«       ‰j                  d«       | j                  ‰ddg«       dŠ‰j                  d«       | j                  ‰g d	¢«       | 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                  ‰ «       y r   )rM   r&   rO   )ÚcallDurationr   Útimess   €€€r   Ú	aCallbackz3LoopTests.test_callbackTimeSkips.<locals>.aCallback  s!   ø€ Ø�L‰L˜Ÿ™›Ô)Ø�M‰M˜,Õ'r   r1   rŽ   r   r+   ç      @g      @)r   rœ   rF   rF   )r   r$   r•   r   Ústartr%   r&   rO   )r   r›   r:   r™   r   rš   s      @@@r   Útest_callbackTimeSkipsz LoopTests.test_callbackTimeSkipsý   s.  ú€ ð ˆØˆÜ—
‘
“ˆö	(ô ×Ñ 	Ó*ˆØˆŒ
ð ˆØ�
‰
�3Œð 	×Ñ˜  Ô$ð 	×Ñ˜Ÿ™›¨,Ô7ð
 	�‰�aÔØ×Ñ˜  Ô$ð ˆØ�‰�cÔØ×Ñ˜  C Ô)Ø×Ñ˜Ÿ™›¨#Ô.ð 	�‰�aÔØ×Ñ˜  C Ô)ð ˆØ�‰�cÔØ×Ñ˜¢Ô,Ø×Ñ˜Ÿ™›¨!Õ,r   c                 óž  ‡‡— g Št        j                  «       Šˆˆfd„}t        j                  |«      }‰|_        |j	                  d«       | j                  ‰dg«       ‰j                  d«       | j                  ‰ddg«       ‰j                  d«       | j                  ‰g d¢«       ‰j                  d«       | j                  ‰g d¢«       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                  «       «       y r   r{   )r   rš   s   €€r   r›   z2LoopTests.test_reactorTimeSkips.<locals>.aCallback;  s   ø€ Ø�L‰L˜Ÿ™›Õ)r   rŽ   r   r1   r+   )r   r1   rE   N)r   r$   r•   r   r�   r%   rO   )r   r›   r:   r   rš   s      @@r   Útest_reactorTimeSkipszLoopTests.test_reactorTimeSkips1  s°   ù€ ð ˆÜ—
‘
“ˆõ	*ô
 ×Ñ 	Ó*ˆØˆŒ
Ø�
‰
�3Œð 	×Ñ˜  Ô$ð 	�‰�aÔØ×Ñ˜  A Ô'ð 	�‰�aÔØ×Ñ˜¢	Ô*ð 	�‰�aÔØ×Ñ˜¢	Õ*r   c                 ó  ‡‡— g Št        j                  «       Šˆˆfd„}t         j                  j                  |«      }‰|_        d}d}|j                  |«       | j                  ‰dg«       ‰j                  ||z   «       | j                  ‰d||z   dfg«       ‰j                  d|z  |z   «       | j                  ‰d||z   dfd|z  d|z  z   dfg«       ‰j                  d	«       | j                  ‰d||z   dfd|z  d|z  z   dfg«       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«       y r   r{   )ÚnumCallsr   rš   s    €€r   r›   z7LoopTests.test_reactorTimeCountSkips.<locals>.aCallback_  s   ø€ Ø�L‰L˜%Ÿ-™-›/¨8Ð4Õ5r   rŽ   ç{®Gáz„?©r   r+   r+   rE   rF   r1   r   N)r   r$   r•   Ú	withCountr   r�   r%   rO   ©r   r›   r:   ÚINTERVALÚREALISTIC_DELAYr   rš   s        @@r   Útest_reactorTimeCountSkipsz$LoopTests.test_reactorTimeCountSkipsS  s2  ù€ ð ˆÜ—
‘
“ˆõ	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¸Ð;ðõ	
r   c                 óX  ‡‡— g Št        j                  «       Šˆˆfd„}t         j                  j                  |«      }‰|_        d}d}|j                  |«       | j                  ‰j                  «       d«       ‰j                  ||z   «       | j                  ‰j                  «       ||z   df«       ‰j                  |dz  «       | j                  ‰j                  «       d|z  |z   df«       ‰j                  |dz  «       | j                  ‰j                  «       d	|z  |z   df«       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«       y r   r{   )Úcountr   rš   s    €€r   r›   z<LoopTests.test_countLengthyIntervalCounts.<locals>.aCallbackž  s   ø€ Ø�L‰L˜%Ÿ-™-›/¨5Ð1Õ2r   rŽ   r¥   r¦   r+   g      ü?g      @g      Ð?ry   N)	r   r$   r•   r§   r   r�   r%   ÚpoprO   r¨   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ÕNr   c                 ó:  — t        j                  «       }g }t         j                  j                  |j                  «      }||_        d}d}||z  }|j                  |d¬«       t        |«      D ]  }|j                  |«       Œ d„ }| ||g|z  «      z
  }	|j                  |	«       |j                  «       }
| j                  t        |	«      dkD  |	› d�«       | j                  |
|k\  |
› d|› �«       | j                   ||«      |«       | j                  d	|«       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.
        rB   r\   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Øò �Ø˜‘‘ðàˆLr   rµ   z should be greater than zeroz$ should be greater than or equal to r   N)r   r$   r•   r§   rM   r   r�   ÚrangerO   r&   r4   Úabsr%   ÚassertNotIn)r   r   Úaccumulatorr:   r®   ÚtimespanÚintervalrj   r¹   Ú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Õ(r   c                 ó*  ‡‡— t        j                  «       }g Šˆˆfd„}t         j                  j                  |«      Š|‰_        ‰j                  dd¬«      }|j                  dgdz  «       | j                  |«       | j                  dgdz  ‰«       y)zy
        L{task.LoopingCall.withCount} with interval set to 0 calls the
        countCallable with a count of 1.
        c                 óf   •— ‰j                  | «       t        ‰«      dkD  r‰j                  «        y y )NrF   ©rM   ÚlenÚstop)Úcntr½   Úloops    €€r   Úfooz1LoopTests.test_withCountIntervalZero.<locals>.foo   s,   ø€ Ø×Ñ˜sÔ#Ü�;Ó !Ò#Ø—	‘	•ð $r   r   Fr²   é   r+   N)	r   r$   r•   r§   r   r�   r�   ÚsuccessResultOfr%   )r   r   rÊ   Údeferredr½   rÉ   s       @@r   Útest_withCountIntervalZeroz$LoopTests.test_withCountIntervalZeroø  sƒ   ù€ ô
 —
‘
“ˆØˆõ	ô
 ×Ñ×)Ñ)¨#Ó.ˆØˆŒ
Ø—:‘:˜a U�:Ó+ˆð 	�
‰
�A�3˜‘7ÔØ×Ñ˜XÔ&à×Ñ˜!˜˜q™ +Õ.r   c                 ó  ‡‡‡— t        j                  «       }t        j                  «       Šg Šˆˆˆfd„}t         j                  j                  |«      Š|‰_        ‰j                  dd¬«       |j                  dgdz  «       | j                  dgdz  ‰«       |j                  dgdz  «       | j                  dgdz  ‰«       ‰j                  d«       |j                  dgdz  «       | j                  dgd	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        ‰«      dk(  r‰S t        ‰«      dkD  r‰j                  «        y y )Nr1   rF   rÅ   )rÈ   r½   rÍ   rÉ   s    €€€r   rÊ   z6LoopTests.test_withCountIntervalZeroDelay.<locals>.foo  s>   ø€ Ø×Ñ˜sÔ#ä�;Ó 1Ò$Ø�ä�;Ó !Ò#Ø—	‘	•ð $r   r   Fr²   r1   r+   NrF   rË   )r   r$   r   ÚDeferredr•   r§   r   r�   r�   r%   Úcallback)r   r   rÊ   r½   rÍ   rÉ   s      @@@r   Útest_withCountIntervalZeroDelayz)LoopTests.test_withCountIntervalZeroDelay  sß   ú€ ô —
‘
“ˆÜ—>‘>Ó#ˆØˆö	ô ×Ñ×)Ñ)¨#Ó.ˆØˆŒ
Ø�
‰
�1˜%ˆ
Ô à�
‰
�A�3˜‘7Ôà×Ñ˜!˜˜q™ +Ô.ð 	�
‰
�A�3˜‘7ÔØ×Ñ˜!˜˜q™ +Ô.ð 	×Ñ˜$ÔØ�
‰
�A�3˜‘7ÔØ×Ñ˜!˜˜q™ +Õ.r   c                 óŽ  ‡	‡
‡— t        j                  «       }t        j                  «       Š
g Š	dŠd}d}d}||z   }||z  }|dz  }ˆ	ˆ
ˆfd„}t         j                  j                  |«      }||_        |j                  dd¬«       |j                  dg‰|z   z  «       | j                  dg‰z  ‰	«       ||_
        ‰
j                  d	«       |j                  |«       | j                  dd|g‰	«       |j                  d|z  «       | j                  dd|dg‰	«       |j                  d|z  «       | j                  dd|ddg‰	«       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.
        r1   rË   é	   r+   c                 óH   •— ‰j                  | «       t        ‰«      ‰k(  r‰S y r   ©rM   rÆ   )rÈ   r½   rÍ   ÚstepsBeforeDelays    €€€r   rÊ   zILoopTests.test_withCountIntervalZeroDelayThenNonZeroInterval.<locals>.foob  s)   ø€ Ø×Ñ˜sÔ#Ü�;ÓÐ#3Ò3Ø�ð 4r   r   Fr²   N)r   r$   r   rÑ   r•   r§   r   r�   r�   r%   r¿   rÒ   rO   )r   r   ÚextraTimeAfterDelayÚmutatedLoopIntervalÚdurationOfDelayÚskippedTimeÚexpectedSkipCountrÊ   rÉ   r½   rÍ   rØ   s            @@@r   Ú2test_withCountIntervalZeroDelayThenNonZeroIntervalz<LoopTests.test_withCountIntervalZeroDelayThenNonZeroInterval8  sd  ú€ ô
 —
‘
“ˆÜ—>‘>Ó#ˆØˆð Ðð
  Ðð  Ðð ˆð
 *¨OÑ;ˆð (Ð+>Ñ>Ðð 	˜QÑÐö	 ô
 ×Ñ×)Ñ)¨#Ó.ˆØˆŒ
Ø�
‰
�1˜%ˆ
Ô ð 	�
‰
�A�3Ð*Ð-@Ñ@ÑAÔBØ×Ñ˜!˜Ð/Ñ/°Ô=ð ,ˆŒØ×Ñ˜$Ôà�‰�oÔ&à×Ñ˜!˜QÐ 1Ð2°KÔ@à�‰�aÐ-Ñ-Ô.Ø×Ñ˜!˜QÐ 1°1Ð5°{ÔCà�‰�aÐ-Ñ-Ô.Ø×Ñ˜!˜QÐ 1°1°aÐ8¸+ÕFr   c                 óT  ‡‡— g d¢}t        j                  «       }g Šdˆfd„	}t        ||ddd¬«      }|j                  d«      }g Šˆfd„}|j	                  |«       |j                  |«       | j                  t        ‰«      d	d
t        ‰«      fz  «       ‰D ]N  \  }}}	}
| j                  |d«       | j                  |d«       | j                  |	«       | j                  |
d«       ŒP |j                  «        | j                  ‰d   |«       | j                  |j                  «       y )N©gš™™™™™©?çš™™™™™¹?rá   c                 ó0   •— ‰j                  | |||f«       y r   rL   )r   r.   r(   ÚdÚLs       €r   rÊ   z(LoopTests.testBasicFunction.<locals>.fooŒ  s   ø€ Ø�H‰H�a˜˜A˜q�\Õ"r   r   r.   rã   ©rã   rá   c                 ó(   •— ‰j                  | «       y r   rL   ©r~   Ú	theResults    €r   Ú
saveResultz/LoopTests.testBasicFunction.<locals>.saveResult”  ó   ø€ Ø×Ñ˜VÕ$r   rE   zgot %d iterations, not 3r   )NN)r   r$   r   r�   ÚaddCallbackr�   r%   rÆ   ÚassertIsNonerÇ   ÚassertIsr?   rn   )r   Útimingsr   rÊ   ÚlcÚDré   r   r.   r(   rã   rä   rè   s              @@r   ÚtestBasicFunctionzLoopTests.testBasicFunction�  s  ù€ ò
 #ˆä—
‘
“ˆàˆõ	#ô ! ¨¨S°#¸Ô=ˆØ�H‰H�S‹Mˆàˆ	ô	%ð 	
�‰�jÔ!à�
‰
�7Ôà×Ñœ˜Q› Ð$>Ä#ÀaÃ&ÀÑ$JÔKàò 	%‰JˆAˆq�!�QØ×Ñ˜Q Ô$Ø×Ñ˜Q Ô$Ø×Ñ˜aÔ Ø×Ñ˜Q Õ$ð		%ð 	�‰Œ	Ø�‰�i ‘l BÔ'ð 	×Ñ˜Ÿ™Õ%r   c                 ó²  ‡— g d¢}t        j                  «       }g }t        ||j                  d «      }|j	                  dd¬«      }g Šˆfd„}|j                  |«       |j                  |«       | j                  t        |«      ddt        |«      fz  «       |j                  «        | j                  ‰d   |«       | j                  |j                  «       y )	Nrà   rá   Fr²   c                 ó(   •— ‰j                  | «       y r   rL   rç   s    €r   ré   z.LoopTests.testDelayedStart.<locals>.saveResult´  rê   r   r1   zgot %d iterations, not 2r   )r   r$   r   rM   r�   rë   r�   r%   rÆ   rÇ   rí   r?   rn   )r   rî   r   rä   rï   rã   ré   rè   s          @r   ÚtestDelayedStartzLoopTests.testDelayedStart©  s¯   ø€ Ú"ˆä—
‘
“ˆàˆÜ  ¨¯©°$Ó7ˆØ�H‰H�S˜eˆHÓ$ˆàˆ	ô	%ð 	
�‰�jÔ!à�
‰
�7Ôà×Ñœ˜Q› Ð$>Ä#ÀaÃ&ÀÑ$JÔKØ
�‰Œ	Ø�‰�i ‘l BÔ'à×Ñ˜Ÿ™Õ%r   c                 ór   — t        j                  d„ «      }| j                  t        |j                  d«       y )Nc                   ó   — y r   r    r    r   r   r/   z(LoopTests.testBadDelay.<locals>.<lambda>Â  r0   r   éÿÿÿÿ)r   r•   rT   Ú
ValueErrorr�   )r   rï   s     r   ÚtestBadDelayzLoopTests.testBadDelayÁ  s(   € Ü×Ñ™lÓ+ˆØ×Ñœ* b§h¡h°Õ3r   c                 óò   ‡— g Šˆfd„}t        j                  «       }t        ||«      }|j                  |d¬«       |j	                  «        | j                  ‰«       | j                  |j                  «       y )Nc                  ó(   •— ‰ j                  d «       y r   rL   ©Úrans   €r   rÊ   z$LoopTests._stoppingTest.<locals>.fooÉ  ó   ø€ Ø�J‰J�tÕr   Fr²   )r   r$   r   r�   rÇ   r?   rn   )r   r^   rÊ   r   rï   rý   s        @r   Ú_stoppingTestzLoopTests._stoppingTestÆ  s_   ø€ Øˆô	ô —
‘
“ˆÜ  ¨Ó,ˆØ
�‰�˜EˆÔ"Ø
�‰Œ	Ø×Ñ˜ÔØ×Ñ˜Ÿ™Õ%r   c                 ó$   — | j                  d«      S )Nr   ©rÿ   ©r   s    r   ÚtestStopAtOncezLoopTests.testStopAtOnceÓ  s   € Ø×!Ñ! !Ó$Ð$r   c                 ó$   — | j                  d«      S )NrB   r  r  s    r   ÚtestStoppingBeforeDelayedStartz(LoopTests.testStoppingBeforeDelayedStartÖ  s   € Ø×!Ñ! "Ó%Ð%r   c                 óJ  ‡— g Šˆfd„}t        j                  «       }t        ||«      }|j                  dd¬«       |j	                  d«       |j                  «        |j	                  d«       | j                  ‰g «       |j	                  d«       | j                  ‰dg«       y)z8
        Test that L{LoopingCall} can be reset.
        c                  ó(   •— ‰ j                  d «       y r   rL   rü   s   €r   rÊ   z!LoopTests.test_reset.<locals>.fooß  rþ   r   r1   Fr²   r+   N)r   r$   r   r�   rO   rb   r%   )r   rÊ   r(   rï   rý   s       @r   Ú
test_resetzLoopTests.test_resetÙ  s„   ø€ ð ˆô	ô �J‰J‹LˆÜ   CÓ(ˆØ
�‰�˜ˆÔØ	�	‰	�!ŒØ
�‰Œ
Ø	�	‰	�!ŒØ×Ñ˜˜bÔ!Ø	�	‰	�!ŒØ×Ñ˜˜t˜fÕ%r   c           	      ón   — | j                  t        t        j                  t        dd¬«      «      d«       y)zO
        L{LoopingCall.__repr__} includes the wrapped function's name.
        r+   r1   )Úkeyz6LoopingCall<None>(installReactor, *(1,), **{'key': 2})N)r%   Úreprr   r•   r   r  s    r   Útest_reprFunctionzLoopTests.test_reprFunctionì  s,   € ð 	×ÑÜ”×!Ñ!¤.°!¸Ô;Ó<ØDõ	
r   c                 ó|   — | j                  t        t        j                  t        j
                  «      «      d«       y)zR
        L{LoopingCall.__repr__} includes the wrapped method's full name.
        z:LoopingCall<None>(TestableLoopingCall.__init__, *(), **{})N)r%   r  r   r•   r   r   r  s    r   Útest_reprMethodzLoopTests.test_reprMethodõ  s/   € ð 	×ÑÜ”×!Ñ!Ô"5×">Ñ">Ó?Ó@ØHõ	
r   c                 ó"  — t        j                  d„ «      }|j                   d}| j                  | j                  g«      }| j                  dt        |«      «       | j                  t        |d   d   «       | j                  ||d   d   «       y)z8
        L{LoopingCall.deferred} is deprecated.
        c                   ó   — y r   r    r    r   r   r/   z4LoopTests.test_deferredDeprecation.<locals>.<lambda>  r0   r   z€twisted.internet.task.LoopingCall.deferred was deprecated in Twisted 16.0.0; please use the deferred returned by start() insteadr+   r   ÚcategoryÚmessageN)r   r•   rÍ   ÚflushWarningsÚtest_deferredDeprecationr%   rÆ   ÚDeprecationWarning)r   rÉ   r  Úwarningss       r   r  z"LoopTests.test_deferredDeprecationþ  sˆ   € ô ×Ñ¡Ó-ˆà�ŠðBð 	ð
 ×%Ñ% t×'DÑ'DÐ&EÓFˆØ×Ñ˜œC ›MÔ*Ø×ÑÔ+¨X°a©[¸Ñ-DÔEØ×Ñ˜ (¨1¡+¨iÑ"8Õ9r   N)r   r   r   r�   r–   rž   r¡   r«   r°   rÂ   rÎ   rÓ   rÞ   rñ   rô   rù   rÿ   r  r  r  r  r  r  r    r   r   r’   r’   ð   sr   „ ñò
.ò2-òh +òD8
òt'OòR@)òD/ò4$/òLGGòR&&òP&ò04ò
&ò%ò&ò&ò&
ò
ó:r   r’   c                   ó<   — e Zd Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
y	)
ÚReactorLoopTestsc                 ó~   — d„ }t        j                  |d«      }| j                  |j                  d«      t        «      S )Nc                 ó   — t        | «      ‚r   ©r   ri   s    r   rÊ   z)ReactorLoopTests.testFailure.<locals>.foo  s   € Ü Ó"Ð"r   Úbarrá   ©r   r•   ÚassertFailurer�   r   ©r   rÊ   rï   s      r   ÚtestFailurezReactorLoopTests.testFailure  s6   € ò	#ô ×Ñ˜c 5Ó)ˆØ×!Ñ! "§(¡(¨3£-´Ó?Ð?r   c                 ó„   ‡— ˆfd„}t        j                  |d«      Š| j                  ‰j                  d«      t        «      S )Nc                 ó:   •— ‰j                  «        t        | «      ‚r   )rÇ   r   )rj   rï   s    €r   rÊ   z-ReactorLoopTests.testFailAndStop.<locals>.foo  s   ø€ Ø�G‰GŒIÜ Ó"Ð"r   r  rá   r  r  s     @r   ÚtestFailAndStopz ReactorLoopTests.testFailAndStop  s7   ø€ ô	#ô ×Ñ˜c 5Ó)ˆØ×!Ñ! "§(¡(¨3£-´Ó?Ð?r   c                 ó’   ‡ ‡‡— g Šˆˆfd„}t        j                  |«      Š‰j                  d«      }ˆˆ fd„}|j                  |«      S )Nc                  óf   •— ‰j                  d «       t        ‰«      dkD  r‰ j                  «        y y )NrË   rÅ   )rï   rý   s   €€r   rÊ   z0ReactorLoopTests.testEveryIteration.<locals>.foo&  s(   ø€ Ø�J‰J�tÔÜ�3‹x˜!Š|Ø—‘•	ð r   r   c                 ó<   •— ‰j                  t        ‰«      d«       y )Né   )r%   rÆ   )Úignrý   r   s    €€r   Ústoppedz4ReactorLoopTests.testEveryIteration.<locals>.stopped.  s   ø€ Ø×ÑœS ›X qÕ)r   )r   r•   r�   rë   )r   rÊ   rã   r)  rï   rý   s   `   @@r   ÚtestEveryIterationz#ReactorLoopTests.testEveryIteration#  sB   ú€ Øˆõ	ô
 ×Ñ˜cÓ"ˆØ�H‰H�Q‹Kˆõ	*ð �}‰}˜WÓ%Ð%r   c                 óê   ‡— t        j                  «       Šˆfd„}t        j                  |«      | _        | j                  j                  dd¬«       t        j                  d| j                  ‰«       ‰S )Nc                  óN   •— ‰ j                  t        j                  d«      «       y )Nz'This task also should never get called.)Úerrbackr   ÚDefaultExceptionrå   s   €r   rÊ   z1ReactorLoopTests.testStopAtOnceLater.<locals>.foo8  s   ø€ Ø�I‰IÜ×(Ñ(Ð)RÓSõr   r+   Fr²   r   )	r   rÑ   r   r•   Ú_lcr�   r   r3   Ú!_callback_for_testStopAtOnceLater)r   rÊ   rã   s     @r   ÚtestStopAtOnceLaterz$ReactorLoopTests.testStopAtOnceLater3  s[   ø€ ô �N‰NÓˆô	ô
 ×#Ñ# CÓ(ˆŒØ�‰�‰�q˜eˆÔ$Ü×Ñ˜!˜T×CÑCÀQÔGØˆr   c                 óz   — | j                   j                  «        t        j                  d|j                  d«       y )Nr   Úsuccess)r/  rÇ   r   r3   rÒ   )r   rã   s     r   r0  z2ReactorLoopTests._callback_for_testStopAtOnceLaterB  s%   € Ø�‰�‰ŒÜ×Ñ˜!˜QŸZ™Z¨Õ3r   c                 óÖ   ‡‡— ddg}t        j                  «       Šˆˆfd„}t        ‰|«      Š‰j                  d«       ‰j	                  |«       | j                  ‰j                  «       y )Nçš™™™™™É?gš™™™™™é?c                  ó’   •— t        j                  «       } | j                  ˆfd„«       ‰j                  d| j                  d «       | S )Nc                 ó$   •— ‰j                  «       S r   )rÇ   )Ú_rï   s    €r   r/   z@ReactorLoopTests.testWaitDeferred.<locals>.foo.<locals>.<lambda>N  s   ø€  B§G¡G£I€ r   r+   )r   rÑ   rë   r3   rÒ   )rã   r   rï   s    €€r   rÊ   z.ReactorLoopTests.testWaitDeferred.<locals>.fooL  s5   ø€ Ü—‘Ó ˆAØ�M‰MÓ-Ô.Ø�O‰O˜A˜qŸz™z¨4Ô0ØˆHr   )r   r$   r   r�   r�   r?   rn   )r   rî   rÊ   r   rï   s      @@r   ÚtestWaitDeferredz!ReactorLoopTests.testWaitDeferredF  sU   ù€ ð ˜�*ˆÜ—
‘
“ˆõ	ô ! ¨Ó,ˆØ
�‰�ŒØ�
‰
�7ÔØ×Ñ˜Ÿ™Õ%r   c                 óþ   ‡— dg}t        j                  «       Šˆfd„}t        ‰|«      }|j                  d«      }| j	                  |t
        «       ‰j                  |«       | j                  ‰j                  «       |S )Nç333333Ó?c                  óz   •— t        j                  «       } ‰j                  d| j                  t	        «       «       | S )Nr;  )r   rÑ   r3   r-  r   )rã   r   s    €r   rÊ   z4ReactorLoopTests.testFailurePropagation.<locals>.fooa  s*   ø€ Ü—‘Ó ˆAØ�O‰O˜C §¡¬M«OÔ<ØˆHr   r+   )	r   r$   r   r�   r  r   r�   r?   rn   )r   rî   rÊ   rï   rã   r   s        @r   ÚtestFailurePropagationz'ReactorLoopTests.testFailurePropagationW  sj   ø€ ð �%ˆÜ—
‘
“ˆô	ô
 ! ¨Ó,ˆØ�H‰H�Q‹KˆØ×Ñ˜1œmÔ,à�
‰
�7ÔØ×Ñ˜Ÿ™Ô%Øˆr   c                 óþ  ‡‡— t        j                  «       }t        j                  «       Šg Šˆˆfd„}t         j                  j                  |«      }||_        |j                  dd¬«      Š| j                  ‰g «       |j                  ddg«       | j                  t        ‰«      d«       ‰j                  d«       |j                  dg«       | j                  t        ‰«      d«       | j                  ‰dd	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        ‰«      dk(  r‰S y ©Nr+   r×   )ÚpossibleCountrã   ÚdeferredCountss    €€r   ÚcountTrackerz=ReactorLoopTests.test_deferredWithCount.<locals>.countTrackerz  s&   ø€ à×!Ñ! -Ô0ä�>Ó" aÒ'Ø�àr   r5  Fr²   gš™™™™™Ù?r+   Nr1   rE   )r   r$   r   rÑ   r•   r§   r   r�   r%   r�   rÆ   rÒ   )r   Ú	testClockrC  rï   rã   rB  s       @@r   Útest_deferredWithCountz'ReactorLoopTests.test_deferredWithCountn  s×   ù€ ô —J‘J“Lˆ	Ü�N‰NÓˆØˆõ	ô ×Ñ×'Ñ'¨Ó5ˆØˆŒØ�H‰H�S˜eˆHÓ$ˆð 	×Ñ˜¨Ô,ð 	�‰˜˜S�zÔ"à×Ñœ˜^Ó,¨aÔ0ð 	
�
‰
�4ÔØ�‰˜�uÔà×Ñœ˜^Ó,¨aÔ0ð 	×Ñ˜¨!¨Q¨Õ0r   N)r   r   r   r   r#  r*  r1  r0  r9  r=  rE  r    r   r   r  r    s,   „ ò@ò@ò&ò ò4ò&ò"ó.*1r   r  c                   ó(   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zy)ÚDeferLaterTestsz'
    Tests for L{task.deferLater}.
    c                 óP  ‡‡— g Št        «       Šˆˆfd„}t        j                  «       }t        j                  |d|dd¬«      }|j	                  | j
                  ‰«       |j                  d«       | j                  ‰g «       |j                  d«       | j                  ‰dg«       |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«       ‰S r   rL   )rÊ   r  ÚflagÚresultss     €€r   Úcallablez/DeferLaterTests.test_callback.<locals>.callable¨  s   ø€ Ø�N‰N˜C ˜:Ô&ØˆKr   rE   rÊ   r  )r  r1   r+   )rÊ   r  )Úobjectr   r$   Ú
deferLaterrë   rí   rO   r%   )r   rL  r   rã   rJ  rK  s       @@r   Útest_callbackzDeferLaterTests.test_callback   s‹   ù€ ð
 ˆÜ‹xˆõ	ô —
‘
“ˆÜ�O‰O˜E 1 h°¸5ÔAˆØ	�‰�d—m‘m TÔ*Ø�‰�aÔØ×Ñ˜ "Ô%Ø�‰�aÔØ×Ñ˜ >Ð"2Ô3Øˆr   c                 ó¬   — d„ }t        j                  «       }t        j                  |d|«      }|j                  d«       | j	                  |t
        «      S )zƒ
        The L{Deferred} returned by L{task.deferLater} is errbacked if the
        supplied function raises an exception.
        c                  ó   — t        «       ‚r   r  r    r   r   rL  z.DeferLaterTests.test_errback.<locals>.callable»  s
   € Ü“/Ð!r   r+   )r   r$   rN  rO   r  r   )r   rL  r   rã   s       r   Útest_errbackzDeferLaterTests.test_errbackµ  sE   € ò	"ô —
‘
“ˆÜ�O‰O˜E 1 hÓ/ˆØ�‰�aÔØ×!Ñ! !¤]Ó3Ð3r   c                 ó  ‡ ‡‡— g Št        j                  «       Št        j                  ‰d‰j                  d«      }|j	                  «        ˆˆˆ fd„}‰ 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   •— ‰j                  g ‰j                  «       «       ‰j                  ‰«       y r   )r%   rl   r?   )ÚignoredÚcalledr   r   s    €€€r   ÚcbCancelledz0DeferLaterTests.test_cancel.<locals>.cbCancelledÍ  s*   ø€ à×Ñ˜R ×!6Ñ!6Ó!8Ô9à×Ñ˜VÕ$r   )	r   r$   rN  rM   r>   r  r   ÚCancelledErrorrë   )r   rã   rW  rV  r   s   `  @@r   Útest_cancelzDeferLaterTests.test_cancelÃ  sd   ú€ ð
 ˆÜ—
‘
“ˆÜ�O‰O˜E 1 f§m¡m°TÓ:ˆØ	�‰Œ
ö	%ð 	×Ñ˜1œe×2Ñ2Ô3Ø	�‰�kÔ"Øˆr   c                 óÞ   — t        j                  «       }t        j                  |d«      }| j                  |«       |j	                  d«       | j                  d| j                  |«      «       y)z€
        The L{Deferred} returned by L{task.deferLater} fires with C{None}
        when no callback function is passed.
        rw   N)r   r$   rN  ÚassertNoResultrO   rí   rÌ   )r   r   rã   s      r   Útest_noCallbackzDeferLaterTests.test_noCallback×  sR   € ô
 —
‘
“ˆÜ�O‰O˜E 3Ó'ˆØ×Ñ˜AÔà�‰�cÔØ�‰�d˜D×0Ñ0°Ó3Õ4r   N)r   r   r   r�   rO  rR  rY  r\  r    r   r   rG  rG  ›  s   „ ñòò*4òó(
5r   rG  c                   ó*   — e Zd Zd„ Zd„ Zd„ Zd„ Zd„ Zy)Ú_FakeReactorc                 ó  — d| _         t        j                  «       | _        | j                  j                  | _        | j                  j
                  | _        | j                  j                  | _        g | _        g g dœ| _        y )NF©ÚbeforeÚduring)	Ú_runningr   r$   Ú_clockr3   r&   rl   Ú_whenRunningÚ_shutdownTriggersr  s    r   r   z_FakeReactor.__init__å  s_   € ØˆŒÜ—j‘j“lˆŒØŸ™×.Ñ.ˆŒØ—{‘{×*Ñ*ˆŒØ#Ÿ{™{×:Ñ:ˆÔØˆÔØ,.¸"Ñ!=ˆÕr   c                 ój   — | j                   €	 ||i |¤Ž y | j                   j                  |||f«       y r   )re  rM   )r   rL  ÚargsÚkwargss       r   ÚcallWhenRunningz_FakeReactor.callWhenRunningî  s6   € Ø×ÑÐ$Ù�dÐ%˜fÓ%à×Ñ×$Ñ$ h°°fÐ%=Õ>r   c                 ó^   — |dv sJ ‚|dk(  sJ ‚| j                   |   j                  ||f«       y )Nr`  Úshutdown)rf  rM   )r   ÚphaseÚeventrL  rh  s        r   ÚaddSystemEventTriggerz"_FakeReactor.addSystemEventTriggerô  s=   € ØÐ,Ñ,Ð,Ð,Ø˜
Ò"Ð"Ð"Ø×Ñ˜uÑ%×,Ñ,¨h¸Ð-=Õ>r   c                 óš  — d| _         | j                  }d| _        |D ]  \  }}} ||i |¤Ž Œ | j                   rg| j                  «       }|st        d«      ‚| j                  j                  |d   j                  «       | j                  «       z
  «       | j                   rŒg| j                  }d| _        |d   |d   z   D ]
  \  }} ||Ž  Œ 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.
        TNzNo DelayedCalls leftr   ra  rb  )	rc  re  rl   ÚRuntimeErrorrd  rO   r7   r&   rf  )r   ÚwhenRunningrL  rh  ri  rn   Ú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ñ	r   c                 óR   — | j                   st        j                  «       ‚d| _         y)z#
        Stop the reactor.
        FN)rc  r   ÚReactorNotRunningr  s    r   rÇ   z_FakeReactor.stop  s!   € ð �}Š}Ü×)Ñ)Ó+Ð+Øˆ�r   N)r   r   r   r   rj  ro  ru  rÇ   r    r   r   r^  r^  ä  s   „ ò>ò?ò?ò
ó,r   r^  c                   óR   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zd
„ Zd„ Zd„ Zy)Ú
ReactTestsz3
    Tests for L{twisted.internet.task.react}.
    c                 ó  ‡— g Šˆfd„}t        «       }| j                  t        t        j                  ||¬«      }| j                  d|j                  «       | j                  ‰dg«       | 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                 ó¨   •— t        j                  «       } | j                  d‰j                  d«        | j                  d|j                  d «       |S ©Nr+   Tr1   ©r   rÑ   r3   rM   rÒ   ©r   ÚfinishedÚ
timePasseds     €r   Úmainz4ReactTests.test_runsUntilAsyncCallback.<locals>.main$  sH   ø€ Ü—~‘~Ó'ˆHØˆG×Ñ˜a ×!2Ñ!2°DÔ9ØˆG×Ñ˜a ×!2Ñ!2°DÔ9ØˆOr   ©Ú_reactorr   Tr1   N©r^  rT   Ú
SystemExitr   Úreactr%   Úcoder&   ©r   r‚  ÚrÚ	exitErrorr�  s       @r   Útest_runsUntilAsyncCallbackz&ReactTests.test_runsUntilAsyncCallback  sq   ø€ ð
 ˆ
ô	ô ‹NˆØ×%Ñ%¤j´$·*±*¸dÈQÐ%ÓOˆ	Ø×Ñ˜˜IŸN™NÔ+Ø×Ñ˜ d VÔ,Ø×Ñ˜Ÿ™› aÕ(r   c                 óä   — d„ }t        «       }| j                  t        t        j                  ||¬«      }| j                  d|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                 ó,   — t        j                  d «      S r   ©r   Úsucceed©r   s    r   r‚  z3ReactTests.test_runsUntilSyncCallback.<locals>.main7  s   € Ü—=‘= Ó&Ð&r   rƒ  r   Nr…  ©r   r‚  rŠ  r‹  s       r   Útest_runsUntilSyncCallbackz%ReactTests.test_runsUntilSyncCallback0  sW   € ò	'ô ‹NˆØ×%Ñ%¤j´$·*±*¸dÈQÐ%ÓOˆ	Ø×Ñ˜˜IŸN™NÔ+Ø×Ñ˜Ÿ™› aÕ(r   c                 ó   ‡—  G d„ dt         «      Šˆfd„}t        «       }| j                  t        t        j
                  ||¬«      }| 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                   ó   — e Zd Zy)ú@ReactTests.test_runsUntilAsyncErrback.<locals>.ExpectedExceptionNr   r    r   r   ÚExpectedExceptionr˜  F  ó   „ Ør   r™  c                 óv   •— t        j                  «       } | j                  d|j                   ‰«       «       |S r@  ©r   rÑ   r3   r-  ©r   r€  r™  s     €r   r‚  z3ReactTests.test_runsUntilAsyncErrback.<locals>.mainI  s2   ø€ Ü—~‘~Ó'ˆHØˆG×Ñ˜a ×!1Ñ!1Ñ3DÓ3FÔGØˆOr   rƒ  r+   N©
Ú	Exceptionr^  rT   r†  r   r‡  r%   rˆ  ÚflushLoggedErrorsrÆ   ©r   r‚  rŠ  r‹  Úerrorsr™  s        @r   Útest_runsUntilAsyncErrbackz%ReactTests.test_runsUntilAsyncErrback?  ss   ø€ ô	¤	ô 	ô	ô
 ‹NˆØ×%Ñ%¤j´$·*±*¸dÈQÐ%ÓOˆ	à×Ñ˜˜IŸN™NÔ+à×'Ñ'Ð(9Ó:ˆØ×Ñœ˜V› aÕ(r   c                 ó`  ‡—  G d„ dt         «      Šˆfd„}t        «       }| j                  t        t        j
                  ||¬«      }| 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                   ó   — e Zd Zy)ú?ReactTests.test_runsUntilSyncErrback.<locals>.ExpectedExceptionNr   r    r   r   r™  r§  ]  rš  r   r™  c                 ó8   •— t        j                   ‰«       «      S r   ©r   Úfail©r   r™  s    €r   r‚  z2ReactTests.test_runsUntilSyncErrback.<locals>.main`  s   ø€ Ü—:‘:Ñ/Ó1Ó2Ð2r   rƒ  r+   r   N©rŸ  r^  rT   r†  r   r‡  r%   rˆ  r&   r   rÆ   r¡  s        @r   Útest_runsUntilSyncErrbackz$ReactTests.test_runsUntilSyncErrbackV  s‰   ø€ ô	¤	ô 	ô	3ô ‹NˆØ×%Ñ%¤j´$·*±*¸dÈQÐ%ÓOˆ	Ø×Ñ˜˜IŸN™NÔ+Ø×Ñ˜Ÿ™› aÔ(Ø×'Ñ'Ð(9Ó:ˆØ×Ñœ˜V› aÕ(r   c                 óä   — d„ }t        «       }| j                  t        t        j                  ||¬«      }| j                  |j                  «       d«       | j                  d|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                 ó¦   —  | j                   d| j                  «       t        j                  «       } | j                  dd|j
                  d «       |S ©Nr+   rb  rl  ©r3   rÇ   r   rÑ   ro  rÒ   ©r   r€  s     r   r‚  z0ReactTests.test_singleStopCallback.<locals>.mainq  sF   € ØˆG×Ñ˜a §¡Ô.Ü—~‘~Ó'ˆHØ)ˆG×)Ñ)¨(°JÀ×@QÑ@QÐSWÔXØˆOr   rƒ  r+   r   N©r^  rT   r†  r   r‡  r%   r&   rˆ  r“  s       r   Útest_singleStopCallbackz"ReactTests.test_singleStopCallbackj  sW   € ò	ô ‹NˆØ×%Ñ%¤j´$·*±*¸dÈQÐ%ÓOˆ	Ø×Ñ˜Ÿ™› aÔ(à×Ñ˜˜IŸN™NÕ+r   c                 ó`  ‡—  G d„ dt         «      Šˆfd„}t        «       }| j                  t        t        j
                  ||¬«      }| 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                   ó   — e Zd Zy)ú<ReactTests.test_singleStopErrback.<locals>.ExpectedExceptionNr   r    r   r   r™  r¹  „  rš  r   r™  c                 ó²   •—  | j                   d| j                  «       t        j                  «       } | j                  dd|j
                   ‰«       «       |S r±  ©r3   rÇ   r   rÑ   ro  r-  r�  s     €r   r‚  z/ReactTests.test_singleStopErrback.<locals>.main‡  sO   ø€ ØˆG×Ñ˜a §¡Ô.Ü—~‘~Ó'ˆHØ)ˆG×)Ñ)Ø˜* h×&6Ñ&6Ñ8IÓ8Kôð ˆOr   rƒ  r+   Nr¬  r¡  s        @r   Útest_singleStopErrbackz!ReactTests.test_singleStopErrback}  s‰   ø€ ô	¤	ô 	ô	ô ‹NˆØ×%Ñ%¤j´$·*±*¸dÈQÐ%ÓOˆ	à×Ñ˜˜IŸN™NÔ+à×Ñ˜Ÿ™› aÔ(Ø×'Ñ'Ð(9Ó:ˆØ×Ñœ˜V› aÕ(r   c                 óÜ   ‡— g Šˆfd„}t        «       }| j                  t        t        j                  |g d¢|¬«      }| j                  d|j                  «       | j                  ‰g d¢«       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«       t        j                  d «      S r   ©Úextendr   r‘  ©r   rj   ÚyÚzrh  s       €r   r‚  z'ReactTests.test_arguments.<locals>.mainŸ  s$   ø€ Ø�K‰K˜˜A˜q˜	Ô"Ü—=‘= Ó&Ð&r   ©r+   r1   rE   rƒ  r   N©r^  rT   r†  r   r‡  r%   rˆ  ©r   r‚  rŠ  r‹  rh  s       @r   Útest_argumentszReactTests.test_arguments˜  sb   ø€ ð
 ˆô	'ô ‹NˆØ×%Ñ%ÜœŸ
™
 Dª)¸að &ó 
ˆ	ð 	×Ñ˜˜IŸN™NÔ+Ø×Ñ˜šyÕ)r   c                 ó4  ‡ — ˆ fd„}t        «       }t        «       5  t        |«       ‰ j                  t        t
        j                  |g «      }‰ j                  d|j                  «       ddd«       ‰ j                  |‰ j                  «       y# 1 sw Y   Œ&xY w)úp
        L{twisted.internet.reactor} is used if no reactor argument is passed to
        L{task.react}.
        c                 ó<   •— | ‰_         t        j                  d «      S r   ©ÚpassedReactorr   r‘  ©r   r   s    €r   r‚  z,ReactTests.test_defaultReactor.<locals>.main°  s   ø€ Ø!(ˆDÔÜ—=‘= Ó&Ð&r   r   N©r^  r	   r   rT   r†  r   r‡  r%   rˆ  rí   rÍ  ©r   r‚  r   r‹  s   `   r   Útest_defaultReactorzReactTests.test_defaultReactorª  sw   ø€ ô	'ô “.ˆÜ‹[ñ 	0Ü˜7Ô#Ø×)Ñ)¬*´d·j±jÀ$ÈÓKˆIØ×Ñ˜Q 	§¡Ô/÷	0ð 	�‰�g˜t×1Ñ1Õ2÷		0ð 	0úó   ›ABÂBc                 ó¦   — d„ }t        «       }| j                  t        t        j                  |g |¬«      }| j                  d|j                  «       y)úŒ
        L{task.react} forwards the exit code specified by the C{SystemExit}
        error returned by the passed function, if any.
        c                 ó>   — t        j                  t        d«      «      S ©Né   ©r   rª  r†  r’  s    r   r‚  z1ReactTests.test_exitWithDefinedCode.<locals>.mainÁ  s   € Ü—:‘:œj¨›nÓ-Ð-r   rƒ  r×  NrÆ  r“  s       r   Útest_exitWithDefinedCodez#ReactTests.test_exitWithDefinedCode»  sD   € ò	.ô ‹NˆØ×%Ñ%¤j´$·*±*¸dÀBÐQRÐ%ÓSˆ	Ø×Ñ˜˜YŸ^™^Õ,r   c                 ó¦   — d„ }t        «       }| j                  t        t        j                  |g |¬«      }| j                  d|j                  «       y)úw
        L{task.react} handles when the reactor is stopped just before the
        returned L{Deferred} fires.
        c                 ób   ‡ ‡— t        j                  «       Šˆˆ fd„} ‰ j                  |«       ‰S )Nc                  óJ   •—  ‰j                   «        ‰ j                  d «       y r   ©rÇ   rÒ   ©rã   r   s   €€r   rÇ   z;ReactTests.test_synchronousStop.<locals>.main.<locals>.stopÑ  ó   ø€ Ø�—‘”Ø—
‘
˜4Õ r   ©r   rÑ   rj  ©r   rÇ   rã   s   ` @r   r‚  z-ReactTests.test_synchronousStop.<locals>.mainÎ  s+   ù€ Ü—‘Ó ˆAõ!ð $ˆG×#Ñ# DÔ)ØˆHr   rƒ  r   NrÆ  r“  s       r   Útest_synchronousStopzReactTests.test_synchronousStopÈ  sD   € ò	ô ‹NˆØ×%Ñ%¤j´$·*±*¸dÀBÐQRÐ%ÓSˆ	Ø×Ñ˜˜IŸN™NÕ+r   c                 ó¦   — d„ }t        «       }| j                  t        t        j                  |g |¬«      }| j                  d|j                  «       y)úv
        L{task.react} handles when the reactor is stopped and the
        returned L{Deferred} doesn't fire.
        c                 ód   —  | j                   d| j                  «       t        j                  «       S r@  ©r3   rÇ   r   rÑ   r’  s    r   r‚  z.ReactTests.test_asynchronousStop.<locals>.mainâ  s%   € ØˆG×Ñ˜a §¡Ô.Ü—>‘>Ó#Ð#r   rƒ  r   NrÆ  r“  s       r   Útest_asynchronousStopz ReactTests.test_asynchronousStopÜ  sD   € ò	$ô ‹NˆØ×%Ñ%¤j´$·*±*¸dÀBÐQRÐ%ÓSˆ	Ø×Ñ˜˜IŸN™NÕ+r   N©r   r   r   r�   rŒ  r”  r£  r­  rµ  r¼  rÈ  rÑ  rÙ  rã  rè  r    r   r   ry  ry    ó>   „ ñò)ò&)ò)ò.)ò(,ò&)ò6*ò$3ò"-ò,ó(,r   ry  c                   óR   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zd
„ Zd„ Zd„ Zy)ÚReactCoroutineFunctionTestszP
    Tests for L{twisted.internet.task.react} with an C{async def} argument
    c                 ó  ‡— g Šˆfd„}t        «       }| j                  t        t        j                  ||¬«      }| j                  d|j                  «       | j                  ‰dg«       | j                  |j                  «       d«       y)r{  c              “   óÄ   •K  — t        j                  «       } | j                  d‰j                  d«        | j                  d|j                  d «       |ƒ d {  –—† S 7 Œ­wr}  r~  r  s     €r   r‚  zEReactCoroutineFunctionTests.test_runsUntilAsyncCallback.<locals>.main÷  sQ   øè ø€ Ü—~‘~Ó'ˆHØˆG×Ñ˜a ×!2Ñ!2°DÔ9ØˆG×Ñ˜a ×!2Ñ!2°DÔ9Ø!—>Ð!�>ús   ƒAA ÁAÁA rƒ  r   Tr1   Nr…  r‰  s       @r   rŒ  z7ReactCoroutineFunctionTests.test_runsUntilAsyncCallbackð  sq   ø€ ð
 ˆ
ô	"ô ‹NˆØ×%Ñ%¤j´$·*±*¸dÈQÐ%ÓOˆ	Ø×Ñ˜˜IŸN™NÔ+Ø×Ñ˜ d VÔ,Ø×Ñ˜Ÿ™› aÕ(r   c                 óä   — d„ }t        «       }| j                  t        t        j                  ||¬«      }| j                  d|j                  «       | j                  |j                  «       d«       y)rŽ  c              “   óH   K  — t        j                  d «      ƒ d {  –—† S 7 Œ­wr   r�  r’  s    r   r‚  zDReactCoroutineFunctionTests.test_runsUntilSyncCallback.<locals>.main
  s   è ø€ ÜŸ™ tÓ,×,Ð,Ð,ús   ‚"› œ"rƒ  r   Nr…  r“  s       r   r”  z6ReactCoroutineFunctionTests.test_runsUntilSyncCallback  sW   € ò	-ô ‹NˆØ×%Ñ%¤j´$·*±*¸dÈQÐ%ÓOˆ	Ø×Ñ˜˜IŸN™NÔ+Ø×Ñ˜Ÿ™› aÕ(r   c                 ó   ‡—  G d„ dt         «      Šˆfd„}t        «       }| j                  t        t        j
                  ||¬«      }| j                  d|j                  «       | j                  ‰«      }| j                  t        |«      d«       y)r–  c                   ó   — e Zd Zy)úQReactCoroutineFunctionTests.test_runsUntilAsyncErrback.<locals>.ExpectedExceptionNr   r    r   r   r™  ró    rš  r   r™  c              “   ó’   •K  — t        j                  «       } | j                  d|j                   ‰«       «       |ƒ d {  –—† S 7 Œ­wr@  rœ  r�  s     €r   r‚  zDReactCoroutineFunctionTests.test_runsUntilAsyncErrback.<locals>.main  s;   øè ø€ Ü—~‘~Ó'ˆHØˆG×Ñ˜a ×!1Ñ!1Ñ3DÓ3FÔGØ!—>Ð!�>ús   ƒ=AÁ AÁArƒ  r+   Nrž  r¡  s        @r   r£  z6ReactCoroutineFunctionTests.test_runsUntilAsyncErrback  ss   ø€ ô	¤	ô 	ô	"ô
 ‹NˆØ×%Ñ%¤j´$·*±*¸dÈQÐ%ÓOˆ	à×Ñ˜˜IŸN™NÔ+à×'Ñ'Ð(9Ó:ˆØ×Ñœ˜V› aÕ(r   c                 ó`  ‡—  G d„ dt         «      Šˆfd„}t        «       }| j                  t        t        j
                  ||¬«      }| j                  d|j                  «       | j                  |j                  «       d«       | j                  ‰«      }| j                  t        |«      d«       y)r¥  c                   ó   — e Zd Zy)úPReactCoroutineFunctionTests.test_runsUntilSyncErrback.<locals>.ExpectedExceptionNr   r    r   r   r™  r÷  0  rš  r   r™  c              “   óT   •K  — t        j                   ‰«       «      ƒ d {  –—† S 7 Œ­wr   r©  r«  s    €r   r‚  zCReactCoroutineFunctionTests.test_runsUntilSyncErrback.<locals>.main3  s    øè ø€ ÜŸ™Ñ$5Ó$7Ó8×8Ð8Ð8ús   ƒ(¡&¢(rƒ  r+   r   Nr¬  r¡  s        @r   r­  z5ReactCoroutineFunctionTests.test_runsUntilSyncErrback)  s‰   ø€ ô	¤	ô 	ô	9ô ‹NˆØ×%Ñ%¤j´$·*±*¸dÈQÐ%ÓOˆ	Ø×Ñ˜˜IŸN™NÔ+Ø×Ñ˜Ÿ™› aÔ(Ø×'Ñ'Ð(9Ó:ˆØ×Ñœ˜V› aÕ(r   c                 óä   — d„ }t        «       }| j                  t        t        j                  ||¬«      }| j                  |j                  «       d«       | j                  d|j                  «       y)r¯  c              “   óÂ   K  —  | j                   d| j                  «       t        j                  «       } | j                  dd|j
                  d «       |ƒ d {  –—† S 7 Œ­wr±  r²  r³  s     r   r‚  zAReactCoroutineFunctionTests.test_singleStopCallback.<locals>.mainD  sO   è ø€ ØˆG×Ñ˜a §¡Ô.Ü—~‘~Ó'ˆHØ)ˆG×)Ñ)¨(°JÀ×@QÑ@QÐSWÔXØ!—>Ð!�>ús   ‚AAÁAÁArƒ  r+   r   Nr´  r“  s       r   rµ  z3ReactCoroutineFunctionTests.test_singleStopCallback=  sW   € ò	"ô ‹NˆØ×%Ñ%¤j´$·*±*¸dÈQÐ%ÓOˆ	Ø×Ñ˜Ÿ™› aÔ(à×Ñ˜˜IŸN™NÕ+r   c                 ó`  ‡—  G d„ dt         «      Šˆfd„}t        «       }| j                  t        t        j
                  ||¬«      }| j                  d|j                  «       | j                  |j                  «       d«       | j                  ‰«      }| j                  t        |«      d«       y)r·  c                   ó   — e Zd Zy)úMReactCoroutineFunctionTests.test_singleStopErrback.<locals>.ExpectedExceptionNr   r    r   r   r™  rý  W  rš  r   r™  c              “   óÎ   •K  —  | j                   d| j                  «       t        j                  «       } | j                  dd|j
                   ‰«       «       |ƒ d {  –—† S 7 Œ­wr±  r»  r�  s     €r   r‚  z@ReactCoroutineFunctionTests.test_singleStopErrback.<locals>.mainZ  sX   øè ø€ ØˆG×Ñ˜a §¡Ô.Ü—~‘~Ó'ˆHØ)ˆG×)Ñ)Ø˜* h×&6Ñ&6Ñ8IÓ8Kôð "—>Ð!�>ús   ƒAA%ÁA#ÁA%rƒ  r+   Nr¬  r¡  s        @r   r¼  z2ReactCoroutineFunctionTests.test_singleStopErrbackP  s‰   ø€ ô	¤	ô 	ô	"ô ‹NˆØ×%Ñ%¤j´$·*±*¸dÈQÐ%ÓOˆ	à×Ñ˜˜IŸN™NÔ+à×Ñ˜Ÿ™› aÔ(Ø×'Ñ'Ð(9Ó:ˆØ×Ñœ˜V› aÕ(r   c                 óÜ   ‡— g Šˆfd„}t        «       }| j                  t        t        j                  |g d¢|¬«      }| j                  d|j                  «       | j                  ‰g d¢«       y)r¾  c              “   ór   •K  — ‰j                  |||f«       t        j                  d «      ƒ d {  –—† S 7 Œ­wr   rÀ  rÂ  s       €r   r‚  z8ReactCoroutineFunctionTests.test_arguments.<locals>.mainr  s.   øè ø€ Ø�K‰K˜˜A˜q˜	Ô"ÜŸ™ tÓ,×,Ð,Ð,ús   ƒ-7°5±7rÅ  rƒ  r   NrÆ  rÇ  s       @r   rÈ  z*ReactCoroutineFunctionTests.test_argumentsk  sb   ø€ ð
 ˆô	-ô ‹NˆØ×%Ñ%ÜœŸ
™
 Dª)¸að &ó 
ˆ	ð 	×Ñ˜˜IŸN™NÔ+Ø×Ñ˜šyÕ)r   c                 ó4  ‡ — ˆ fd„}t        «       }t        «       5  t        |«       ‰ j                  t        t
        j                  |g «      }‰ j                  d|j                  «       ddd«       ‰ j                  |‰ j                  «       y# 1 sw Y   Œ&xY w)rÊ  c              “   óX   •K  — | ‰_         t        j                  d «      ƒ d {  –—† S 7 Œ­wr   rÌ  rÎ  s    €r   r‚  z=ReactCoroutineFunctionTests.test_defaultReactor.<locals>.mainƒ  s$   øè ø€ Ø!(ˆDÔÜŸ™ tÓ,×,Ð,Ð,ús   ƒ *£(¤*r   NrÏ  rÐ  s   `   r   rÑ  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        «       }| j                  t        t        j                  |g |¬«      }| j                  d|j                  «       y)rÔ  c              “   óZ   K  — t        j                  t        d«      «      ƒ d {  –—† S 7 Œ­wrÖ  rØ  r’  s    r   r‚  zBReactCoroutineFunctionTests.test_exitWithDefinedCode.<locals>.main”  s   è ø€ ÜŸ™¤J¨r£NÓ3×3Ð3Ð3ús   ‚"+¤)¥+rƒ  r×  NrÆ  r“  s       r   rÙ  z4ReactCoroutineFunctionTests.test_exitWithDefinedCodeŽ  sD   € ò	4ô ‹NˆØ×%Ñ%¤j´$·*±*¸dÀBÐQRÐ%ÓSˆ	Ø×Ñ˜˜YŸ^™^Õ,r   c                 ó¦   — d„ }t        «       }| j                  t        t        j                  |g |¬«      }| j                  d|j                  «       y)rÛ  c              “   ó~   ‡ ‡K  — t        j                  «       Šˆˆ fd„} ‰ j                  |«       ‰ƒ d {  –—† S 7 Œ­w)Nc                  óJ   •—  ‰j                   «        ‰ j                  d «       y r   rÞ  rß  s   €€r   rÇ   zLReactCoroutineFunctionTests.test_synchronousStop.<locals>.main.<locals>.stop¤  rà  r   rá  râ  s   ` @r   r‚  z>ReactCoroutineFunctionTests.test_synchronousStop.<locals>.main¡  s3   ùè ø€ Ü—‘Ó ˆAõ!ð $ˆG×#Ñ# DÔ)Ø—7ˆN�7ús   „2=¶;·=rƒ  r   NrÆ  r“  s       r   rã  z0ReactCoroutineFunctionTests.test_synchronousStop›  sD   € ò	ô ‹NˆØ×%Ñ%¤j´$·*±*¸dÀBÐQRÐ%ÓSˆ	Ø×Ñ˜˜IŸN™NÕ+r   c                 ó¦   — d„ }t        «       }| j                  t        t        j                  |g |¬«      }| j                  d|j                  «       y)rå  c              “   ó€   K  —  | j                   d| j                  «       t        j                  «       ƒ d {  –—† S 7 Œ­wr@  rç  r’  s    r   r‚  z?ReactCoroutineFunctionTests.test_asynchronousStop.<locals>.mainµ  s/   è ø€ ØˆG×Ñ˜a §¡Ô.ÜŸ™Ó)×)Ð)Ð)ús   ‚5>·<¸>rƒ  r   NrÆ  r“  s       r   rè  z1ReactCoroutineFunctionTests.test_asynchronousStop¯  sD   € ò	*ô ‹NˆØ×%Ñ%¤j´$·*±*¸dÀBÐQRÐ%ÓSˆ	Ø×Ñ˜˜IŸN™NÕ+r   Nré  r    r   r   rì  rì  ë  rê  r   rì  N)r�   Útwisted.internetr   r   r   r   r   Útwisted.internet.mainr   Ú#twisted.internet.test.modulehelpersr	   Útwisted.trialr
   r$   Útwisted.pythonr   r•   r   rŸ  r   ÚTestCaser"   r’   r  rG  r^  ÚSynchronousTestCasery  rì  r    r   r   ú<module>r     sÐ   ðñ÷
 EÕ DÝ 0Ý 9Ý "ð 	�
‰
€å "ô˜$×*Ñ*ô ô	�Iô 	ôO+�×"Ñ"ô O+ôd^:�×!Ñ!ô ^:ôBG1�x×(Ñ(ô G1ôTF5�h×'Ñ'ô F5÷R1ñ 1ôhP,�×-Ñ-ô P,ôfP, (×">Ñ">õ P,r   