ó
    ×›‘hç¾  ã                   ó¼  • S r SSKJrJrJrJrJr  SSKJr  SSK	J
r
  SSKJr  \R                  rSSKJr   " S S\R                   5      r " S	 S
\5      r " S S\R(                  5      r " S S\R(                  5      r " S S\R(                  5      r " S S\R(                  5      r " S S5      r " S S\R4                  5      r " S S\R4                  5      rg)z%
Tests for L{twisted.internet.task}.
é    )ÚdeferÚerrorÚ
interfacesÚreactorÚtask)ÚinstallReactor)Ú	NoReactor)Úunittest)Úfailurec                   ó(   ^ • \ rS rSrU 4S jrSrU =r$ )ÚTestableLoopingCallé   c                 ó2   >• [         TU ]  " U0 UD6  Xl        g ©N)ÚsuperÚ__init__Úclock)Úselfr   ÚaÚkwÚ	__class__s       €ÚZC:\Users\psant\Downloads\Noiseback\school\venv\Lib\site-packages\twisted/test/test_task.pyr   ÚTestableLoopingCall.__init__   s   ø€ Ü‰Ò˜!Ð"˜rÒ"Ø�
ó    )r   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r   Ú__static_attributes__Ú__classcell__)r   s   @r   r   r      s   ø† ÷ó r   r   c                   ó   • \ rS rSrSrg)ÚTestExceptioné   © N©r   r   r   r   r   r$   r   r   r"   r"      s   † Úr   r"   c                   ór   • \ rS rSrSrS rS rS rS rS r	S r
S	 rS
 rS rS rS rS rS rS rS rSrg)Ú
ClockTestsé   z4
Test the non-wallclock based clock implementation.
c                 ón   • [         R                  " 5       nU R                  UR                  5       S5        g)zF
Test that the C{seconds} method of the fake clock returns fake time.
r   N)r   ÚClockÚassertEqualÚseconds©r   Úcs     r   ÚtestSecondsÚClockTests.testSeconds#   s%   € ô �JŠJ‹LˆØ×Ñ˜Ÿ™› aÕ(r   c                 ó.  • [         R                  " 5       nUR                  SS SSS9nU R                  [        R
                  R                  U5      5        U R                  UR                  5       S5        U R                  UR                  5       5        g)zc
Test that calls can be scheduled for later with the fake clock and
hands back an L{IDelayedCall}.
é   c                 ó   • g r   r$   ©r   Úbs     r   Ú<lambda>Ú*ClockTests.testCallLater.<locals>.<lambda>0   ó   € ¨4r   é   ©r5   N)
r   r*   Ú	callLaterÚ
assertTruer   ÚIDelayedCallÚ
providedByr+   ÚgetTimeÚactive©r   r.   Úcalls      r   ÚtestCallLaterÚClockTests.testCallLater*   sk   € ô
 �JŠJ‹LˆØ�{‰{˜1Ñ/°°aˆ{Ð8ˆØ�‰œ
×/Ñ/×:Ñ:¸4Ó@ÔAØ×Ñ˜Ÿ™›¨Ô+Ø�‰˜Ÿ™›Õ&r   c                 ó²   • [         R                  " 5       nUR                  SS SSS9nUR                  5         U R	                  UR                  5       5        g)z#
Test that calls can be cancelled.
r2   c                 ó   • g r   r$   r4   s     r   r6   Ú3ClockTests.testCallLaterCancelled.<locals>.<lambda>:   r8   r   r9   r:   N)r   r*   r;   ÚcancelÚassertFalser@   rA   s      r   ÚtestCallLaterCancelledÚ!ClockTests.testCallLaterCancelled5   sC   € ô �JŠJ‹LˆØ�{‰{˜1Ñ/°°aˆ{Ð8ˆØ�‰ŒØ×Ñ˜Ÿ™›Õ'r   c                 óž   • [         R                  " 5       nUR                  SS SSS9nUR                  SS SSS9nU R                  X#L 5        g	)
zC
Test that the DelayedCall returned is not one previously
created.
é
   c                 ó   • g r   r$   r4   s     r   r6   Ú3ClockTests.test_callLaterOrdering.<locals>.<lambda>D   s   € ¨Tr   r2   r9   r:   c                 ó   • g r   r$   r4   s     r   r6   rO   E   s   € ¨Dr   é   é   N)r   r*   r;   rI   )r   r.   Úcall1Úcall2s       r   Útest_callLaterOrderingÚ!ClockTests.test_callLaterOrdering>   sM   € ô
 �JŠJ‹LˆØ—‘˜BÑ 1°1¸�Ð:ˆØ—‘˜AÑ0°!°q�Ð9ˆØ×Ñ˜˜Õ(r   c                 ó,  ^• / m[         R                  " 5       nUR                  SU4S j5      nUR                  S5        U R	                  T/ 5        UR                  S5        U R	                  TS/5        U R                  UR                  5       5        g)z5
Test that advancing the clock will fire some calls.
r9   c                  ó&   >• T R                  S 5      $ r   ©Úappend)Úeventss   €r   r6   Ú(ClockTests.testAdvance.<locals>.<lambda>N   s   ø€  f§m¡m°DÔ&9r   r2   N)r   r*   r;   Úadvancer+   rI   r@   ©r   r.   rB   r[   s      @r   ÚtestAdvanceÚClockTests.testAdvanceH   sr   ø€ ð ˆÜ�JŠJ‹LˆØ�{‰{˜1Ô9Ó:ˆØ	�	‰	�!ŒØ×Ñ˜ Ô$Ø	�	‰	�!ŒØ×Ñ˜ $ Ô(Ø×Ñ˜Ÿ™›Õ'r   c                 ó†   ^ ^• [         R                  " 5       nUU 4S jnUR                  SU5      mUR                  S5        g)zÝ
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   >• TR                  [        R                  T R                  5        g r   )ÚassertRaisesr   ÚAlreadyCalledrH   )rB   r   s   €€r   ÚcbÚ(ClockTests.testAdvanceCancel.<locals>.cb_   s   ø€ Ø×Ñœe×1Ñ1°4·;±;Õ?r   r2   N)r   r*   r;   r]   )r   r.   re   rB   s   `  @r   ÚtestAdvanceCancelÚClockTests.testAdvanceCancelU   s3   ù€ ô �JŠJ‹Lˆö	@ð �{‰{˜1˜bÓ!ˆØ	�	‰	�!�r   c                 óP  ^• / m[         R                  " 5       nUR                  SU4S jSSS9nUR                  S5        U R	                  UR                  5       S5        UR                  S5        U R	                  T/ 5        UR                  S5        U R	                  TS/5        g)	z!
Test that calls can be delayed.
r2   c                 ó(   >• TR                  X45      $ r   rY   ©r   r5   r[   s     €r   r6   Ú1ClockTests.testCallLaterDelayed.<locals>.<lambda>k   ó   ø€ ¨6¯=©=¸!¸Ô+@r   r9   r:   g      ø?ç      ð?©r2   r9   N)r   r*   r;   Údelayr+   r?   r]   r^   s      @r   ÚtestCallLaterDelayedÚClockTests.testCallLaterDelayede   s…   ø€ ð ˆÜ�JŠJ‹LˆØ�{‰{˜1Ô@À!Àqˆ{ÐIˆØ�
‰
�1ŒØ×Ñ˜Ÿ™›¨Ô+Ø	�	‰	�#ŒØ×Ñ˜ Ô$Ø	�	‰	�#ŒØ×Ñ˜ & Õ*r   c                 ór  ^• / m[         R                  " 5       nUR                  SU4S jSSS9nUR                  S5        UR	                  S5        U R                  UR                  5       S5        UR                  S5        U R                  T/ 5        UR                  S5        U R                  TS/5        g)	z<
Test that calls can have their time reset to a later time.
r9   c                 ó(   >• TR                  X45      $ r   rY   rk   s     €r   r6   Ú4ClockTests.testCallLaterResetLater.<locals>.<lambda>y   rm   r   r2   r:   rQ   rR   ro   N)r   r*   r;   r]   Úresetr+   r?   r^   s      @r   ÚtestCallLaterResetLaterÚ"ClockTests.testCallLaterResetLaters   s�   ø€ ð ˆÜ�JŠJ‹LˆØ�{‰{˜1Ô@À!Àqˆ{ÐIˆØ	�	‰	�!ŒØ�
‰
�1ŒØ×Ñ˜Ÿ™›¨Ô+Ø	�	‰	�!ŒØ×Ñ˜ Ô$Ø	�	‰	�!ŒØ×Ñ˜ & Õ*r   c                 ó
  ^• / m[         R                  " 5       nUR                  SU4S jSSS9nUR                  S5        U R	                  UR                  5       S5        UR                  S5        U R	                  TS/5        g)	z?
Test that calls can have their time reset to an earlier time.
rR   c                 ó(   >• TR                  X45      $ r   rY   rk   s     €r   r6   Ú5ClockTests.testCallLaterResetSooner.<locals>.<lambda>ˆ   rm   r   r2   r9   r:   rQ   ro   N)r   r*   r;   rv   r+   r?   r]   r^   s      @r   ÚtestCallLaterResetSoonerÚ#ClockTests.testCallLaterResetSooner‚   sj   ø€ ð ˆÜ�JŠJ‹LˆØ�{‰{˜1Ô@À!Àqˆ{ÐIˆØ�
‰
�1ŒØ×Ñ˜Ÿ™›¨Ô+Ø	�	‰	�!ŒØ×Ñ˜ & Õ*r   c                 óÒ   • [         R                  " 5       nUR                  SS 5      nUR                  SS 5      nUR                  5       nU R	                  X#1[        U5      5        g)z2
Test that we can get a list of all delayed calls
r2   c                 ó   • g r   r$   ©Úxs    r   r6   Ú1ClockTests.test_getDelayedCalls.<locals>.<lambda>“   ó   € ¨r   r9   c                 ó   • g r   r$   r€   s    r   r6   r‚   ”   s   € ¨r   N)r   r*   r;   ÚgetDelayedCallsr+   Úset)r   r.   rB   rT   Úcallss        r   Útest_getDelayedCallsÚClockTests.test_getDelayedCallsŽ   sS   € ô �JŠJ‹LˆØ�{‰{˜1™nÓ-ˆØ—‘˜A™~Ó.ˆà×!Ñ!Ó#ˆà×Ñ˜$˜¬¨E«
Õ3r   c                 ón   • [         R                  " 5       nU R                  UR                  5       / 5        g)zS
Test that we get an empty list from getDelayedCalls on a newly
constructed Clock.
N)r   r*   r+   r…   r-   s     r   Útest_getDelayedCallsEmptyÚ$ClockTests.test_getDelayedCallsEmptyš   s(   € ô
 �JŠJ‹LˆØ×Ñ˜×*Ñ*Ó,¨bÕ1r   c                 óŒ   • [         R                  " 5       nU R                  [        R                  R                  U5      S5        g )Nz#Clock does not provide IReactorTime)r   r*   r<   r   ÚIReactorTimer>   r-   s     r   Útest_providesIReactorTimeÚ$ClockTests.test_providesIReactorTime¢   s0   € Ü�JŠJ‹LˆØ�‰Ü×#Ñ#×.Ñ.¨qÓ1Ð3Xõ	
r   c                 ó  ^^• / mSS/n[         R                  " 5       mUU4S jnTR                  SUS5      nUR                  S5        TR                  SUS5        TR	                  S	/S
-  5        U R                  TU5        g)aì  
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".
©r5   ç       @©r   ç      @c                 óF   >• TR                  U TR                  5       45      $ r   ©rZ   r,   ©Únr   Úresults    €€r   r6   Ú<ClockTests.test_callLaterKeepsCallsOrdered.<locals>.<lambda>·   ó   ø€ ˜FŸM™M¨1¨e¯m©m«oÐ*>Ô?r   rn   r   r•   r“   r5   r2   rQ   N©r   r*   r;   rv   Úpumpr+   ©r   ÚexpectedÚlogtimeÚcall_ar   rš   s       @@r   Útest_callLaterKeepsCallsOrderedÚ*ClockTests.test_callLaterKeepsCallsOrdered¨   st   ù€ ð ˆØ 
Ð+ˆÜ—
’
“ˆÝ?ˆà—‘  g¨sÓ3ˆØ�‰�SÔØ�‰˜˜W cÔ*à�
‰
�A�3˜‘7ÔØ×Ñ˜ Õ*r   c                 ó  ^^• / mSS/n[         R                  " 5       mUU4S jnTR                  SUS5      nTR                  SUS5        UR                  S5        TR	                  S	/S
-  5        U R                  TU5        g)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".
r’   r”   c                 óF   >• TR                  U TR                  5       45      $ r   r—   r˜   s    €€r   r6   ÚAClockTests.test_callLaterResetKeepsCallsOrdered.<locals>.<lambda>Ï   rœ   r   rn   r   r“   r5   r•   r2   rQ   Nr�   rŸ   s       @@r   Ú$test_callLaterResetKeepsCallsOrderedÚ/ClockTests.test_callLaterResetKeepsCallsOrderedÀ   st   ù€ ð ˆØ 
Ð+ˆÜ—
’
“ˆÝ?ˆà—‘  g¨sÓ3ˆØ�‰˜˜W cÔ*Ø�‰�SÔà�
‰
�A�3˜‘7ÔØ×Ñ˜ Õ*r   c                 ó  ^^^• / mSS/n[         R                  " 5       mUU4S jnTR                  SUS5      mU4S jnTR                  SU5        TR                  SUS	5        TR                  S
/S-  5        U R	                  TU5        g)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}, even when that call to C{reset}
occurs within the callable scheduled by C{callLater} itself.
)r.   r•   )r5   g      @c                 óF   >• TR                  U TR                  5       45      $ r   r—   r˜   s    €€r   r6   ÚKClockTests.test_callLaterResetInsideCallKeepsCallsOrdered.<locals>.<lambda>â   rœ   r   r“   r5   c                  ó(   >• T R                  S5        g )Nr•   )rv   )Úcall_bs   €r   r   ÚDClockTests.test_callLaterResetInsideCallKeepsCallsOrdered.<locals>.aæ   s   ø€ Ø�L‰L˜Õr   rn   r•   r.   ç      à?rM   N)r   r*   r;   rž   r+   )r   r    r¡   r   r®   r   rš   s       @@@r   Ú.test_callLaterResetInsideCallKeepsCallsOrderedÚ9ClockTests.test_callLaterResetInsideCallKeepsCallsOrderedØ   s}   ú€ ð ˆØ 
Ð+ˆÜ—
’
“ˆÝ?ˆà—‘  g¨sÓ3ˆõ	ð 	�‰˜˜QÔØ�‰˜˜W cÔ*à�
‰
�C�5˜2‘:ÔØ×Ñ˜ Õ*r   r$   N)r   r   r   r   Ú__doc__r/   rC   rJ   rU   r_   rg   rq   rw   r|   rˆ   r‹   r�   r£   r¨   r±   r   r$   r   r   r'   r'      sR   † ñò)ò	'ò(ò)ò(òò +ò+ò
+ò
4ò2ò
ò+ò0+õ0+r   r'   c                   óŠ   • \ rS rSrSrS rS rS rS rS r	S r
S	 rS
 rS rS rS rS rS rS rS rS rS rS rS rSrg)Ú	LoopTestséð   zO
Tests for L{task.LoopingCall} based on a fake L{IReactorTime}
implementation.
c                 ór   • [         R                  " S 5      nU R                  UR                  [        5        g)z7
L{LoopingCall}'s default clock should be the reactor.
c                  ó   • g r   r$   r$   r   r   r6   Ú-LoopTests.test_defaultClock.<locals>.<lambda>ú   rƒ   r   N)r   ÚLoopingCallr+   r   r   )r   rB   s     r   Útest_defaultClockÚLoopTests.test_defaultClockö   s(   € ô ×Ò¡Ó-ˆØ×Ñ˜Ÿ™¤WÕ-r   c                 óÀ  ^^^• / mSm[         R                  " 5       mUUU4S jn[         R                  " U5      nTUl        SmUR	                  S5        U R                  TS/5        U R                  TR                  5       T5        TR                  S5        U R                  TS/5        SmTR                  S5        U R                  TSS/5        U R                  TR                  5       S5        TR                  S5        U R                  TSS/5        SmTR                  S5        U R                  T/ S	Q5        U R                  TR                  5       S
5        g)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   >• TR                  TR                  5       5        TR                  T 5        g r   )rZ   r,   r]   )ÚcallDurationr   Útimess   €€€r   Ú	aCallbackÚ3LoopTests.test_callbackTimeSkips.<locals>.aCallback  s!   ø€ Ø�L‰L˜Ÿ™›Ô)Ø�M‰M˜,Õ'r   r9   r°   r   r2   ç      @g      @)r   rÃ   rR   rR   )r   r*   rº   r   Ústartr+   r,   r]   )r   rÁ   rB   r¿   r   rÀ   s      @@@r   Útest_callbackTimeSkipsÚ LoopTests.test_callbackTimeSkipsý   s.  ú€ ð ˆØˆÜ—
’
“ˆ÷	(ô ×Ò 	Ó*ˆØˆŒ
ð ˆØ�
‰
�3Œð 	×Ñ˜  Ô$ð 	×Ñ˜Ÿ™›¨,Ô7ð
 	�‰�aÔØ×Ñ˜  Ô$ð ˆØ�‰�cÔØ×Ñ˜  C Ô)Ø×Ñ˜Ÿ™›¨#Ô.ð 	�‰�aÔØ×Ñ˜  C Ô)ð ˆØ�‰�cÔØ×Ñ˜¢Ô,Ø×Ñ˜Ÿ™›¨!Õ,r   c                 ó¤  ^^• / m[         R                  " 5       mUU4S jn[         R                  " U5      nTUl        UR	                  S5        U R                  TS/5        TR                  S5        U R                  TSS/5        TR                  S5        U R                  T/ SQ5        TR                  S5        U R                  T/ SQ5        g)zá
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   >• TR                  T R                  5       5        g r   r—   )r   rÀ   s   €€r   rÁ   Ú2LoopTests.test_reactorTimeSkips.<locals>.aCallback;  s   ø€ Ø�L‰L˜Ÿ™›Õ)r   r°   r   r9   r2   )r   r9   rQ   N)r   r*   rº   r   rÄ   r+   r]   )r   rÁ   rB   r   rÀ   s      @@r   Útest_reactorTimeSkipsÚLoopTests.test_reactorTimeSkips1  s°   ù€ ð ˆÜ—
’
“ˆö	*ô
 ×Ò 	Ó*ˆØˆŒ
Ø�
‰
�3Œð 	×Ñ˜  Ô$ð 	�‰�aÔØ×Ñ˜  A Ô'ð 	�‰�aÔØ×Ñ˜¢	Ô*ð 	�‰�aÔØ×Ñ˜¢	Õ*r   c                 ó  ^^• / m[         R                  " 5       mUU4S jn[         R                  R                  U5      nTUl        SnSnUR                  U5        U R                  TS/5        TR                  X4-   5        U R                  TSX4-   S4/5        TR                  SU-  U-   5        U R                  TSX4-   S4SU-  SU-  -   S4/5        TR                  S	5        U R                  TSX4-   S4SU-  SU-  -   S4/5        g
)at  
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   >• TR                  TR                  5       U 45        g r   r—   )ÚnumCallsr   rÀ   s    €€r   rÁ   Ú7LoopTests.test_reactorTimeCountSkips.<locals>.aCallback_  s   ø€ Ø�L‰L˜%Ÿ-™-›/¨8Ð4Õ5r   r°   ç{®Gáz„?©r   r2   r2   rQ   rR   r9   r   N)r   r*   rº   Ú	withCountr   rÄ   r+   r]   ©r   rÁ   rB   ÚINTERVALÚREALISTIC_DELAYr   rÀ   s        @@r   Útest_reactorTimeCountSkipsÚ$LoopTests.test_reactorTimeCountSkipsS  s*  ù€ ð ˆÜ—
’
“ˆö	6ô
 ×Ñ×)Ñ)¨)Ó4ˆØˆŒ
ØˆØˆØ�
‰
�8Ôð 	×Ñ˜  Ô)ð
 	�‰�hÑ0Ô1Ø×Ñ˜ ¨(Ñ*DÀaÐ)HÐ IÔJð 	�‰�q˜8‘| Ñ6Ô7Ø×ÑØàØÑ+¨QÐ/Ø�h‘, 1 Ñ#6Ñ7¸Ð;ðô	
ð 	�‰�aÔØ×ÑØàØÑ+¨QÐ/Ø�h‘, 1 Ñ#6Ñ7¸Ð;ðõ	
r   c                 óX  ^^• / m[         R                  " 5       mUU4S jn[         R                  R                  U5      nTUl        SnSnUR                  U5        U R                  TR                  5       S5        TR                  X4-   5        U R                  TR                  5       X4-   S45        TR                  US-  5        U R                  TR                  5       SU-  U-   S45        TR                  US-  5        U R                  TR                  5       S	U-  U-   S45        g
)aÑ  
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   >• TR                  TR                  5       U 45        g r   r—   )Úcountr   rÀ   s    €€r   rÁ   Ú<LoopTests.test_countLengthyIntervalCounts.<locals>.aCallbackž  s   ø€ Ø�L‰L˜%Ÿ-™-›/¨5Ð1Õ2r   r°   rÐ   rÑ   r2   g      ü?g      @g      Ð?r•   N)	r   r*   rº   rÒ   r   rÄ   r+   Úpopr]   rÓ   s        @@r   Útest_countLengthyIntervalCountsÚ)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                 ó2  • [         R                  " 5       n/ n[         R                  R                  UR                  5      nXl        SnSnXT-  nUR                  USS9  [        U5       H  nUR                  U5        M     S nXX" U/U-  5      -
  n	UR                  U	5        UR                  5       n
U R                  [        U	5      S:„  U	 S35        U R                  X¥:¬  U
 SU 35        U R                  U" U5      U5        U R                  S	U5        g
)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.
rM   rn   F©Únowc                 ó$   • SnU  H  nX-  nM	     U$ )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_compatÚALoopTests.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Ò   rZ   r   rÄ   Úranger]   r,   r<   Úabsr+   ÚassertNotIn)r   r   ÚaccumulatorrB   rÚ   ÚtimespanÚintervalr�   rç   ÚepsilonÚsecondsValues              r   Ú#test_withCountFloatingPointBoundaryÚ-LoopTests.test_withCountFloatingPointBoundary¶  s  € ô —
’
“ˆØˆÜ×Ñ×)Ñ)¨+×*<Ñ*<Ó=ˆØŒ
ð
 ˆð ˆàÑ#ˆà�
‰
�8 ˆ
Ñ'Ü�u–ˆAØ�M‰M˜(Ö#ñ ò
	ð ˜Z¨¨
°UÑ(:Ó;Ñ;ˆØ�‰�gÔØ—}‘}“ˆð 	�‰œ˜G› sÑ*¨w¨iÐ7SÐ,TÔUð 	�‰ØÑ$ØˆnÐ@ÀÀ
ÐKô	
ð
 	×Ñ™ KÓ0°%Ô8Ø×Ñ˜˜KÕ(r   c                 ó(  ^^• [         R                  " 5       n/ mUU4S jn[         R                  R                  U5      mUTl        TR                  SSS9nUR                  S/S-  5        U R                  U5        U R                  S/S-  T5        g)za
L{task.LoopingCall.withCount} with interval set to 0 calls the
countCallable with a count of 1.
c                 óh   >• TR                  U 5        [        T5      S:”  a  TR                  5         g g )NrR   ©rZ   ÚlenÚstop)Úcntrì   Úloops    €€r   ÚfooÚ1LoopTests.test_withCountIntervalZero.<locals>.foo   s,   ø€ Ø×Ñ˜sÔ#Ü�;Ó !Ó#Ø—	‘	•ð $r   r   Frà   é   r2   N)	r   r*   rº   rÒ   r   rÄ   rž   ÚsuccessResultOfr+   )r   r   rú   Údeferredrì   rù   s       @@r   Útest_withCountIntervalZeroÚ$LoopTests.test_withCountIntervalZeroø  sƒ   ù€ ô
 —
’
“ˆØˆö	ô
 ×Ñ×)Ñ)¨#Ó.ˆØˆŒ
Ø—:‘:˜a U�:Ð+ˆð 	�
‰
�A�3˜‘7ÔØ×Ñ˜XÔ&à×Ñ˜!˜˜q™ +Õ.r   c                 ó  ^^^• [         R                  " 5       n[        R                  " 5       m/ mUUU4S jn[         R                  R                  U5      mUTl        TR                  SSS9  UR                  S/S-  5        U R                  S/S-  T5        UR                  S/S-  5        U R                  S/S-  T5        TR                  S5        UR                  S/S-  5        U R                  S/S	-  T5        g)
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                 óŠ   >• TR                  U 5        [        T5      S:X  a  T$ [        T5      S:”  a  TR                  5         g g )Nr9   rR   rõ   )rø   rì   rþ   rù   s    €€€r   rú   Ú6LoopTests.test_withCountIntervalZeroDelay.<locals>.foo  s>   ø€ Ø×Ñ˜sÔ#ä�;Ó 1Ó$Ø�ä�;Ó !Ó#Ø—	‘	•ð $r   r   Frà   r9   r2   NrR   rü   )r   r*   r   ÚDeferredrº   rÒ   r   rÄ   rž   r+   Úcallback)r   r   rú   rì   rþ   rù   s      @@@r   Útest_withCountIntervalZeroDelayÚ)LoopTests.test_withCountIntervalZeroDelay  sß   ú€ ô —
’
“ˆÜ—>’>Ó#ˆØˆ÷	ô ×Ñ×)Ñ)¨#Ó.ˆØˆŒ
Ø�
‰
�1˜%ˆ
Ñ à�
‰
�A�3˜‘7Ôà×Ñ˜!˜˜q™ +Ô.ð 	�
‰
�A�3˜‘7ÔØ×Ñ˜!˜˜q™ +Ô.ð 	×Ñ˜$ÔØ�
‰
�A�3˜‘7ÔØ×Ñ˜!˜˜q™ +Õ.r   c                 ó†  ^	^
^• [         R                  " 5       n[        R                  " 5       m
/ m	SmSnSnSnX$-   nXS-  nUS-  nU	U
U4S jn[         R                  R                  U5      nXl        UR                  SSS9  UR                  S/TU-   -  5        U R                  S/T-  T	5        X8l
        T
R                  S	5        UR                  U5        U R                  SSU/T	5        UR                  SU-  5        U R                  SSUS/T	5        UR                  SU-  5        U R                  SSUSS/T	5        g	)
z
L{task.LoopingCall.withCount} with interval set to 0 will still keep
the time when last called so when the interval is reset.
r9   rü   é	   r2   c                 óJ   >• TR                  U 5        [        T5      T:X  a  T$ g r   ©rZ   rö   )rø   rì   rþ   ÚstepsBeforeDelays    €€€r   rú   ÚILoopTests.test_withCountIntervalZeroDelayThenNonZeroInterval.<locals>.foob  s)   ø€ Ø×Ñ˜sÔ#Ü�;ÓÐ#3Ó3Ø�ð 4r   r   Frà   N)r   r*   r   r  rº   rÒ   r   rÄ   rž   r+   rî   r  r]   )r   r   ÚextraTimeAfterDelayÚmutatedLoopIntervalÚdurationOfDelayÚskippedTimeÚexpectedSkipCountrú   rù   rì   rþ   r  s            @@@r   Ú2test_withCountIntervalZeroDelayThenNonZeroIntervalÚ<LoopTests.test_withCountIntervalZeroDelayThenNonZeroInterval8  s[  ú€ ô
 —
’
“ˆÜ—>’>Ó#ˆØˆð Ðð
  Ðð  Ðð ˆð
 *Ñ;ˆð (Ñ>Ðð 	˜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  ^^• / SQn[         R                  " 5       n/ mSU4S jjn[        X#SSSS9nUR                  S5      n/ mU4S jnUR	                  U5        UR                  U5        U R                  [        T5      S	S
[        T5      4-  5        T HM  u  pxpšU R                  US5        U R                  US5        U R                  U	5        U R                  U
S5        MO     UR                  5         U R                  TS   U5        U R                  UR                  5        g )N©gš™™™™™©?çš™™™™™¹?r  c                 ó,   >• TR                  XX#45        g r   rY   )r   r5   r.   ÚdÚLs       €r   rú   Ú(LoopTests.testBasicFunction.<locals>.fooŒ  s   ø€ Ø�H‰H�a˜A�\Õ"r   r   r5   r  ©r  r  c                 ó(   >• TR                  U 5        g r   rY   ©rš   Ú	theResults    €r   Ú
saveResultÚ/LoopTests.testBasicFunction.<locals>.saveResult”  ó   ø€ Ø×Ñ˜VÕ$r   rQ   zgot %d iterations, not 3r   )NN)r   r*   r   rÄ   ÚaddCallbackrž   r+   rö   ÚassertIsNoner÷   ÚassertIsrI   r‡   )r   Útimingsr   rú   ÚlcÚDr   r   r5   r.   r  r  r  s              @@r   ÚtestBasicFunctionÚLoopTests.testBasicFunction�  s  ù€ ò
 #ˆä—
’
“ˆàˆ÷	#ô ! ¨S°#¸Ñ=ˆØ�H‰H�S‹Mˆàˆ	õ	%ð 	
�‰�jÔ!à�
‰
�7Ôà×Ñœ˜Q› Ð$>Ä#ÀaÃ&ÀÑ$JÔKã‰JˆA�!Ø×Ñ˜Q Ô$Ø×Ñ˜Q Ô$Ø×Ñ˜aÔ Ø×Ñ˜Q Ö$ñ	 ð 	�‰Œ	Ø�‰�i ‘l BÔ'ð 	×Ñ˜Ÿ™Õ%r   c                 ó®  ^• / SQn[         R                  " 5       n/ n[        X#R                  S 5      nUR	                  SSS9n/ mU4S jnUR                  U5        UR                  U5        U R                  [        U5      SS[        U5      4-  5        UR                  5         U R                  TS   U5        U R                  UR                  5        g )	Nr  r  Frà   c                 ó(   >• TR                  U 5        g r   rY   r  s    €r   r   Ú.LoopTests.testDelayedStart.<locals>.saveResult´  r"  r   r9   zgot %d iterations, not 2r   )r   r*   r   rZ   rÄ   r#  rž   r+   rö   r÷   r%  rI   r‡   )r   r&  r   r  r'  r  r   r  s          @r   ÚtestDelayedStartÚLoopTests.testDelayedStart©  s­   ø€ Ú"ˆä—
’
“ˆàˆÜ  ¯©°$Ó7ˆØ�H‰H�S˜eˆHÐ$ˆàˆ	õ	%ð 	
�‰�jÔ!à�
‰
�7Ôà×Ñœ˜Q› Ð$>Ä#ÀaÃ&ÀÑ$JÔKØ
�‰Œ	Ø�‰�i ‘l BÔ'à×Ñ˜Ÿ™Õ%r   c                 ót   • [         R                  " S 5      nU R                  [        UR                  S5        g )Nc                  ó   • g r   r$   r$   r   r   r6   Ú(LoopTests.testBadDelay.<locals>.<lambda>Â  s   €  dr   éÿÿÿÿ)r   rº   rc   Ú
ValueErrorrÄ   )r   r'  s     r   ÚtestBadDelayÚLoopTests.testBadDelayÁ  s(   € Ü×Ò™lÓ+ˆØ×Ñœ* b§h¡h°Õ3r   c                 óî   ^• / mU4S jn[         R                  " 5       n[        X25      nUR                  USS9  UR	                  5         U R                  T5        U R                  UR                  5        g )Nc                  ó(   >• T R                  S 5        g r   rY   ©Úrans   €r   rú   Ú$LoopTests._stoppingTest.<locals>.fooÉ  ó   ø€ Ø�J‰J�tÕr   Frà   )r   r*   r   rÄ   r÷   rI   r‡   )r   rp   rú   r   r'  r:  s        @r   Ú_stoppingTestÚLoopTests._stoppingTestÆ  s]   ø€ Øˆõ	ô —
’
“ˆÜ  Ó,ˆØ
�‰�˜EˆÑ"Ø
�‰Œ	Ø×Ñ˜ÔØ×Ñ˜Ÿ™Õ%r   c                 ó$   • U R                  S5      $ )Nr   ©r=  ©r   s    r   ÚtestStopAtOnceÚLoopTests.testStopAtOnceÓ  s   € Ø×!Ñ! !Ó$Ð$r   c                 ó$   • U R                  S5      $ )NrM   r@  rA  s    r   ÚtestStoppingBeforeDelayedStartÚ(LoopTests.testStoppingBeforeDelayedStartÖ  s   € Ø×!Ñ! "Ó%Ð%r   c                 óF  ^• / mU4S jn[         R                  " 5       n[        X!5      nUR                  SSS9  UR	                  S5        UR                  5         UR	                  S5        U R                  T/ 5        UR	                  S5        U R                  TS/5        g)z(
Test that L{LoopingCall} can be reset.
c                  ó(   >• T R                  S 5        g r   rY   r9  s   €r   rú   Ú!LoopTests.test_reset.<locals>.fooß  r<  r   r9   Frà   r2   N)r   r*   r   rÄ   r]   rv   r+   )r   rú   r.   r'  r:  s       @r   Ú
test_resetÚLoopTests.test_resetÙ  s‚   ø€ ð ˆõ	ô �JŠJ‹LˆÜ  Ó(ˆØ
�‰�˜ˆÑØ	�	‰	�!ŒØ
�‰Œ
Ø	�	‰	�!ŒØ×Ñ˜˜bÔ!Ø	�	‰	�!ŒØ×Ñ˜˜t˜fÕ%r   c           
      ój   • U R                  [        [        R                  " [        SSS95      S5        g)z?
L{LoopingCall.__repr__} includes the wrapped function's name.
r2   r9   )Úkeyz6LoopingCall<None>(installReactor, *(1,), **{'key': 2})N)r+   Úreprr   rº   r   rA  s    r   Útest_reprFunctionÚLoopTests.test_reprFunctionì  s,   € ð 	×ÑÜ”×!Ò!¤.°!¸Ñ;Ó<ØDõ	
r   c                 ó~   • U R                  [        [        R                  " [        R
                  5      5      S5        g)zB
L{LoopingCall.__repr__} includes the wrapped method's full name.
z:LoopingCall<None>(TestableLoopingCall.__init__, *(), **{})N)r+   rN  r   rº   r   r   rA  s    r   Útest_reprMethodÚLoopTests.test_reprMethodõ  s/   € ð 	×ÑÜ”×!Ò!Ô"5×">Ñ">Ó?Ó@ØHõ	
r   c                 ó"  • [         R                  " S 5      nUR                    SnU R                  U R                  /5      nU R                  S[        U5      5        U R                  [        US   S   5        U R                  X#S   S   5        g)z(
L{LoopingCall.deferred} is deprecated.
c                  ó   • g r   r$   r$   r   r   r6   Ú4LoopTests.test_deferredDeprecation.<locals>.<lambda>  rƒ   r   z€twisted.internet.task.LoopingCall.deferred was deprecated in Twisted 16.0.0; please use the deferred returned by start() insteadr2   r   ÚcategoryÚmessageN)r   rº   rþ   ÚflushWarningsÚtest_deferredDeprecationr+   rö   ÚDeprecationWarning)r   rù   rX  Úwarningss       r   rZ  Ú"LoopTests.test_deferredDeprecationþ  s†   € ô ×Ò¡Ó-ˆà�ŠðBð 	ð
 ×%Ñ% t×'DÑ'DÐ&EÓFˆØ×Ñ˜œC ›MÔ*Ø×ÑÔ+¨X°a©[¸Ñ-DÔEØ×Ñ˜¨1¡+¨iÑ"8Õ9r   r$   N)r   r   r   r   r³   r»   rÅ   rÊ   rÖ   rÝ   rñ   rÿ   r  r  r)  r.  r5  r=  rB  rE  rJ  rO  rR  rZ  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                   óD   • \ rS rSrS rS rS rS rS rS r	S r
S	 rS
rg)ÚReactorLoopTestsi  c                 ó€   • S n[         R                  " US5      nU R                  UR                  S5      [        5      $ )Nc                 ó   • [        U 5      er   ©r"   r€   s    r   rú   Ú)ReactorLoopTests.testFailure.<locals>.foo  s   € Ü Ó"Ð"r   Úbarr  ©r   rº   ÚassertFailurerÄ   r"   ©r   rú   r'  s      r   ÚtestFailureÚReactorLoopTests.testFailure  s6   € ò	#ô ×Ò˜c 5Ó)ˆØ×!Ñ! "§(¡(¨3£-´Ó?Ð?r   c                 óˆ   ^• U4S jn[         R                  " US5      mU R                  TR                  S5      [        5      $ )Nc                 ó:   >• TR                  5         [        U 5      er   )r÷   r"   )r�   r'  s    €r   rú   Ú-ReactorLoopTests.testFailAndStop.<locals>.foo  s   ø€ Ø�G‰GŒIÜ Ó"Ð"r   rd  r  re  rg  s     @r   ÚtestFailAndStopÚ ReactorLoopTests.testFailAndStop  s7   ø€ õ	#ô ×Ò˜c 5Ó)ˆØ×!Ñ! "§(¡(¨3£-´Ó?Ð?r   c                 ó˜   ^ ^^• / mUU4S jn[         R                  " U5      mTR                  S5      nUU 4S jnUR                  U5      $ )Nc                  óh   >• TR                  S 5        [        T5      S:”  a  T R                  5         g g )Nrü   rõ   )r'  r:  s   €€r   rú   Ú0ReactorLoopTests.testEveryIteration.<locals>.foo&  s(   ø€ Ø�J‰J�tÔÜ�3‹x˜!‹|Ø—‘•	ð r   r   c                 ó<   >• TR                  [        T5      S5        g )Né   )r+   rö   )Úignr:  r   s    €€r   ÚstoppedÚ4ReactorLoopTests.testEveryIteration.<locals>.stopped.  s   ø€ Ø×ÑœS ›X qÕ)r   )r   rº   rÄ   r#  )r   rú   r  ru  r'  r:  s   `   @@r   ÚtestEveryIterationÚ#ReactorLoopTests.testEveryIteration#  sB   ú€ Øˆö	ô
 ×Ò˜cÓ"ˆØ�H‰H�Q‹Kˆö	*ð �}‰}˜WÓ%Ð%r   c                 óì   ^• [         R                  " 5       mU4S jn[        R                  " U5      U l        U R                  R                  SSS9  [        R                  " SU R                  T5        T$ )Nc                  óP   >• T R                  [        R                  " S5      5        g )Nz'This task also should never get called.)Úerrbackr   ÚDefaultExceptionr  s   €r   rú   Ú1ReactorLoopTests.testStopAtOnceLater.<locals>.foo8  s   ø€ Ø�I‰IÜ×(Ò(Ð)RÓSõr   r2   Frà   r   )	r   r  r   rº   Ú_lcrÄ   r   r;   Ú!_callback_for_testStopAtOnceLater)r   rú   r  s     @r   ÚtestStopAtOnceLaterÚ$ReactorLoopTests.testStopAtOnceLater3  s[   ø€ ô �NŠNÓˆõ	ô
 ×#Ò# CÓ(ˆŒØ�‰�‰�q˜eˆÑ$Ü×Ò˜!˜T×CÑCÀQÔGØˆr   c                 ó|   • U R                   R                  5         [        R                  " SUR                  S5        g )Nr   Úsuccess)r~  r÷   r   r;   r  )r   r  s     r   r  Ú2ReactorLoopTests._callback_for_testStopAtOnceLaterB  s%   € Ø�‰�‰ŒÜ×Ò˜!˜QŸZ™Z¨Õ3r   c                 óÚ   ^^• SS/n[         R                  " 5       mUU4S jn[        TU5      mTR                  S5        TR	                  U5        U R                  TR                  5        g )Nçš™™™™™É?gš™™™™™é?c                  ó–   >• [         R                  " 5       n U R                  U4S j5        TR                  SU R                  S 5        U $ )Nc                 ó$   >• TR                  5       $ r   )r÷   )Ú_r'  s    €r   r6   Ú@ReactorLoopTests.testWaitDeferred.<locals>.foo.<locals>.<lambda>N  s   ø€  B§G¡G¤Ir   r2   )r   r  r#  r;   r  )r  r   r'  s    €€r   rú   Ú.ReactorLoopTests.testWaitDeferred.<locals>.fooL  s5   ø€ Ü—’Ó ˆAØ�M‰MÔ-Ô.Ø�O‰O˜A˜qŸz™z¨4Ô0ØˆHr   )r   r*   r   rÄ   rž   rI   r‡   )r   r&  rú   r   r'  s      @@r   ÚtestWaitDeferredÚ!ReactorLoopTests.testWaitDeferredF  sU   ù€ ð ˜�*ˆÜ—
’
“ˆö	ô ! ¨Ó,ˆØ
�‰�ŒØ�
‰
�7ÔØ×Ñ˜Ÿ™Õ%r   c                 ó  ^• S/n[         R                  " 5       mU4S jn[        TU5      nUR                  S5      nU R	                  U[
        5        TR                  U5        U R                  TR                  5        U$ )Nç333333Ó?c                  ó|   >• [         R                  " 5       n TR                  SU R                  [	        5       5        U $ )Nr�  )r   r  r;   r{  r"   )r  r   s    €r   rú   Ú4ReactorLoopTests.testFailurePropagation.<locals>.fooa  s*   ø€ Ü—’Ó ˆAØ�O‰O˜C §¡¬M«OÔ<ØˆHr   r2   )	r   r*   r   rÄ   rf  r"   rž   rI   r‡   )r   r&  rú   r'  r  r   s        @r   ÚtestFailurePropagationÚ'ReactorLoopTests.testFailurePropagationW  sj   ø€ ð �%ˆÜ—
’
“ˆõ	ô
 ! ¨Ó,ˆØ�H‰H�Q‹KˆØ×Ñ˜1œmÔ,à�
‰
�7ÔØ×Ñ˜Ÿ™Ô%Øˆr   c                 óü  ^^• [         R                  " 5       n[        R                  " 5       m/ mUU4S jn[         R                  R                  U5      nXl        UR                  SSS9mU R                  T/ 5        UR                  SS/5        U R                  [        T5      S5        TR                  S5        UR                  S/5        U R                  [        T5      S5        U R                  TSS	/5        g)
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                 óJ   >• TR                  U 5        [        T5      S:X  a  T$ g ©Nr2   r  )ÚpossibleCountr  ÚdeferredCountss    €€r   ÚcountTrackerÚ=ReactorLoopTests.test_deferredWithCount.<locals>.countTrackerz  s&   ø€ à×!Ñ! -Ô0ä�>Ó" aÓ'Ø�àr   r†  Frà   gš™™™™™Ù?r2   Nr9   rQ   )r   r*   r   r  rº   rÒ   r   rÄ   r+   rž   rö   r  )r   Ú	testClockr™  r'  r  r˜  s       @@r   Útest_deferredWithCountÚ'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   )r~  N)r   r   r   r   rh  rm  rw  r€  r  rŒ  r’  rœ  r   r$   r   r   r_  r_    s,   † ò@ò@ò&ò ò4ò&ò"õ.*1r   r_  c                   ó0   • \ rS rSrSrS rS rS rS rSr	g)	ÚDeferLaterTestsi›  z
Tests for L{task.deferLater}.
c                 óP  ^^• / m[        5       mUU4S jn[        R                  " 5       n[        R                  " USUSSS9nUR	                  U R
                  T5        UR                  S5        U R                  T/ 5        UR                  S5        U R                  TS/5        U$ )	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                 ó,   >• TR                  X45        T$ r   rY   )rú   rd  ÚflagÚresultss     €€r   ÚcallableÚ/DeferLaterTests.test_callback.<locals>.callable¨  s   ø€ Ø�N‰N˜C˜:Ô&ØˆKr   rQ   rú   rd  )rd  r9   r2   )rú   rd  )Úobjectr   r*   Ú
deferLaterr#  r%  r]   r+   )r   r¤  r   r  r¢  r£  s       @@r   Útest_callbackÚDeferLaterTests.test_callback   s‹   ù€ ð
 ˆÜ‹xˆö	ô —
’
“ˆÜ�OŠO˜E 1 h°¸5ÑAˆØ	�‰�d—m‘m TÔ*Ø�‰�aÔØ×Ñ˜ "Ô%Ø�‰�aÔØ×Ñ˜ >Ð"2Ô3Øˆr   c                 ó°   • S n[         R                  " 5       n[         R                  " USU5      nUR                  S5        U R	                  U[
        5      $ )zk
The L{Deferred} returned by L{task.deferLater} is errbacked if the
supplied function raises an exception.
c                  ó   • [        5       er   rb  r$   r   r   r¤  Ú.DeferLaterTests.test_errback.<locals>.callable»  s
   € Ü“/Ð!r   r2   )r   r*   r§  r]   rf  r"   )r   r¤  r   r  s       r   Útest_errbackÚDeferLaterTests.test_errbackµ  sE   € ò	"ô —
’
“ˆÜ�OŠO˜E 1 hÓ/ˆØ�‰�aÔØ×!Ñ! !¤]Ó3Ð3r   c                 ó  ^ ^^• / m[         R                  " 5       m[         R                  " TSTR                  S5      nUR	                  5         UUU 4S jnT R                  U[        R                  5        UR                  U5        U$ )zt
The L{Deferred} returned by L{task.deferLater} can be
cancelled to prevent the call from actually being performed.
r2   Nc                 óh   >• TR                  / TR                  5       5        TR                  T5        g r   )r+   r…   rI   )ÚignoredÚcalledr   r   s    €€€r   ÚcbCancelledÚ0DeferLaterTests.test_cancel.<locals>.cbCancelledÍ  s*   ø€ à×Ñ˜R ×!6Ñ!6Ó!8Ô9à×Ñ˜VÕ$r   )	r   r*   r§  rZ   rH   rf  r   ÚCancelledErrorr#  )r   r  r³  r²  r   s   `  @@r   Útest_cancelÚDeferLaterTests.test_cancelÃ  sd   ú€ ð
 ˆÜ—
’
“ˆÜ�OŠO˜E 1 f§m¡m°TÓ:ˆØ	�‰Œ
÷	%ð 	×Ñ˜1œe×2Ñ2Ô3Ø	�‰�kÔ"Øˆr   c                 óâ   • [         R                  " 5       n[         R                  " US5      nU R                  U5        UR	                  S5        U R                  SU R                  U5      5        g)zh
The L{Deferred} returned by L{task.deferLater} fires with C{None}
when no callback function is passed.
r“   N)r   r*   r§  ÚassertNoResultr]   r%  rý   )r   r   r  s      r   Útest_noCallbackÚDeferLaterTests.test_noCallback×  sR   € ô
 —
’
“ˆÜ�OŠO˜E 3Ó'ˆØ×Ñ˜AÔà�‰�cÔØ�‰�d˜D×0Ñ0°Ó3Õ4r   r$   N)
r   r   r   r   r³   r¨  r­  r¶  rº  r   r$   r   r   rŸ  rŸ  ›  s   † ñòò*4òõ(
5r   rŸ  c                   ó2   • \ rS rSrS rS rS rS rS rSr	g)	Ú_FakeReactoriä  c                 ó
  • SU l         [        R                  " 5       U l        U R                  R                  U l        U R                  R
                  U l        U R                  R                  U l        / U l        / / S.U l        g )NF©ÚbeforeÚduring)	Ú_runningr   r*   Ú_clockr;   r,   r…   Ú_whenRunningÚ_shutdownTriggersrA  s    r   r   Ú_FakeReactor.__init__å  s_   € ØˆŒÜ—j’j“lˆŒØŸ™×.Ñ.ˆŒØ—{‘{×*Ñ*ˆŒØ#Ÿ{™{×:Ñ:ˆÔØˆÔØ,.¸"Ñ!=ˆÕr   c                 ój   • U R                   c	  U" U0 UD6  g U R                   R                  XU45        g r   )rÄ  rZ   )r   r¤  ÚargsÚkwargss       r   ÚcallWhenRunningÚ_FakeReactor.callWhenRunningî  s4   € Ø×ÑÑ$Ù�dÐ%˜fÓ%à×Ñ×$Ñ$ h°fÐ%=Õ>r   c                 ób   • US;   d   eUS:X  d   eU R                   U   R                  X445        g )Nr¿  Úshutdown)rÅ  rZ   )r   ÚphaseÚeventr¤  rÈ  s        r   ÚaddSystemEventTriggerÚ"_FakeReactor.addSystemEventTriggerô  s;   € ØÐ,Ó,Ð,Ð,Ø˜
Ó"Ð"Ð"Ø×Ñ˜uÑ%×,Ñ,¨hÐ-=Õ>r   c                 ó¾  • SU l         U R                  nSU l        U H  u  p#nU" U0 UD6  M     U R                   (       ar  U R                  5       nU(       d  [        S5      eU R                  R                  US   R                  5       U R                  5       -
  5        U R                   (       a  Mr  U R                  nSU l        US   US   -    H
  u  psU" U6   M     g)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   rÀ  rÁ  )	rÂ  rÄ  r…   ÚRuntimeErrorrÃ  r]   r?   r,   rÅ  )r   ÚwhenRunningr¤  rÈ  rÉ  r‡   ÚshutdownTriggersÚtriggers           r   ÚrunÚ_FakeReactor.runù  sÍ   € ð ˆŒØ×'Ñ'ˆØ ˆÔÛ&1Ñ"ˆH˜FÙ�dÐ%˜fÔ%ñ '2à�m�mØ×(Ñ(Ó*ˆEÞÜ"Ð#9Ó:Ð:Ø�K‰K×Ñ  a¡× 0Ñ 0Ó 2°T·\±\³^Ñ CÔDð	 �m�m‰mð
  ×1Ñ1ÐØ!%ˆÔØ-¨hÑ7Ð:JÈ8Ñ:TÔT‰MˆGÙ�T‹Nò Ur   c                 ó^   • U R                   (       d  [        R                  " 5       eSU l         g)z
Stop the reactor.
FN)rÂ  r   ÚReactorNotRunningrA  s    r   r÷   Ú_FakeReactor.stop  s!   € ð �}�}Ü×)Ò)Ó+Ð+Øˆ�r   )rÃ  rÂ  rÅ  rÄ  r;   r…   r,   N)
r   r   r   r   r   rÊ  rÐ  r×  r÷   r   r$   r   r   r½  r½  ä  s   † ò>ò?ò?ò
õ,r   r½  c                   óZ   • \ rS rSrSrS rS rS rS rS r	S r
S	 rS
 rS rS rS rSrg)Ú
ReactTestsi  z+
Tests for L{twisted.internet.task.react}.
c                 ó  ^• / mU4S jn[        5       nU R                  [        [        R                  XS9nU R                  SUR                  5        U R                  TS/5        U R                  UR                  5       S5        g)ú{
L{task.react} runs the reactor until the L{Deferred} returned by the
function it is passed is called back, then stops it.
c                 óª   >• [         R                  " 5       nU R                  " STR                  S5        U R                  " SUR                  S 5        U$ ©Nr2   Tr9   ©r   r  r;   rZ   r  ©r   ÚfinishedÚ
timePasseds     €r   ÚmainÚ4ReactTests.test_runsUntilAsyncCallback.<locals>.main$  sD   ø€ Ü—~’~Ó'ˆHØ×Ò˜a ×!2Ñ!2°DÔ9Ø×Ò˜a ×!2Ñ!2°DÔ9ØˆOr   ©Ú_reactorr   Tr9   N©r½  rc   Ú
SystemExitr   Úreactr+   Úcoder,   ©r   ræ  ÚrÚ	exitErrorrå  s       @r   Útest_runsUntilAsyncCallbackÚ&ReactTests.test_runsUntilAsyncCallback  so   ø€ ð
 ˆ
õ	ô ‹NˆØ×%Ñ%¤j´$·*±*¸dÐ%ÐOˆ	Ø×Ñ˜˜IŸN™NÔ+Ø×Ñ˜ d VÔ,Ø×Ñ˜Ÿ™› aÕ(r   c                 óÜ   • S n[        5       nU R                  [        [        R                  XS9nU R                  SUR                  5        U R                  UR                  5       S5        g)ú‘
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                 ó.   • [         R                  " S 5      $ r   ©r   Úsucceed©r   s    r   ræ  Ú3ReactTests.test_runsUntilSyncCallback.<locals>.main7  s   € Ü—=’= Ó&Ð&r   rè  r   Nrê  ©r   ræ  rï  rð  s       r   Útest_runsUntilSyncCallbackÚ%ReactTests.test_runsUntilSyncCallback0  sU   € ò	'ô ‹NˆØ×%Ñ%¤j´$·*±*¸dÐ%ÐOˆ	Ø×Ñ˜˜IŸN™NÔ+Ø×Ñ˜Ÿ™› aÕ(r   c                 ó  ^•  " S S[         5      mU4S jn[        5       nU R                  [        [        R
                  XS9nU R                  SUR                  5        U R                  T5      nU R                  [        U5      S5        g)ú¡
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                   ó   • \ rS rSrSrg)Ú@ReactTests.test_runsUntilAsyncErrback.<locals>.ExpectedExceptioniF  r$   Nr%   r$   r   r   ÚExpectedExceptionr   F  ó   † Úr   r  c                 óx   >• [         R                  " 5       nU R                  " SUR                  T" 5       5        U$ r–  ©r   r  r;   r{  ©r   rä  r  s     €r   ræ  Ú3ReactTests.test_runsUntilAsyncErrback.<locals>.mainI  s0   ø€ Ü—~’~Ó'ˆHØ×Ò˜a ×!1Ñ!1Ñ3DÓ3FÔGØˆOr   rè  r2   N©
Ú	Exceptionr½  rc   rë  r   rì  r+   rí  ÚflushLoggedErrorsrö   ©r   ræ  rï  rð  Úerrorsr  s        @r   Útest_runsUntilAsyncErrbackÚ%ReactTests.test_runsUntilAsyncErrback?  sq   ø€ ô	¤	ô 	õ	ô
 ‹NˆØ×%Ñ%¤j´$·*±*¸dÐ%ÐOˆ	à×Ñ˜˜IŸN™NÔ+à×'Ñ'Ð(9Ó:ˆØ×Ñœ˜V› aÕ(r   c                 óZ  ^•  " S S[         5      mU4S jn[        5       nU R                  [        [        R
                  XS9nU R                  SUR                  5        U R                  UR                  5       S5        U R                  T5      nU R                  [        U5      S5        g)ú•
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                   ó   • \ rS rSrSrg)Ú?ReactTests.test_runsUntilSyncErrback.<locals>.ExpectedExceptioni]  r$   Nr%   r$   r   r   r  r  ]  r  r   r  c                 ó:   >• [         R                  " T" 5       5      $ r   ©r   Úfail©r   r  s    €r   ræ  Ú2ReactTests.test_runsUntilSyncErrback.<locals>.main`  s   ø€ Ü—:’:Ñ/Ó1Ó2Ð2r   rè  r2   r   N©r  r½  rc   rë  r   rì  r+   rí  r,   r	  rö   r
  s        @r   Útest_runsUntilSyncErrbackÚ$ReactTests.test_runsUntilSyncErrbackV  s‡   ø€ ô	¤	ô 	õ	3ô ‹NˆØ×%Ñ%¤j´$·*±*¸dÐ%ÐOˆ	Ø×Ñ˜˜IŸN™NÔ+Ø×Ñ˜Ÿ™› aÔ(Ø×'Ñ'Ð(9Ó:ˆØ×Ñœ˜V› aÕ(r   c                 óÜ   • S n[        5       nU R                  [        [        R                  XS9nU R                  UR                  5       S5        U R                  SUR                  5        g)ú�
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                 ó¨   • U R                   " SU R                  5        [        R                  " 5       nU R                  " SSUR
                  S 5        U$ ©Nr2   rÁ  rÍ  ©r;   r÷   r   r  rÐ  r  ©r   rä  s     r   ræ  Ú0ReactTests.test_singleStopCallback.<locals>.mainq  sB   € Ø×Ò˜a §¡Ô.Ü—~’~Ó'ˆHØ×)Ò)¨(°JÀ×@QÑ@QÐSWÔXØˆOr   rè  r2   r   N©r½  rc   rë  r   rì  r+   r,   rí  rú  s       r   Útest_singleStopCallbackÚ"ReactTests.test_singleStopCallbackj  sU   € ò	ô ‹NˆØ×%Ñ%¤j´$·*±*¸dÐ%ÐOˆ	Ø×Ñ˜Ÿ™› aÔ(à×Ñ˜˜IŸN™NÕ+r   c                 óZ  ^•  " S S[         5      mU4S jn[        5       nU R                  [        [        R
                  XS9nU R                  SUR                  5        U R                  UR                  5       S5        U R                  T5      nU R                  [        U5      S5        g)ú›
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                   ó   • \ rS rSrSrg)Ú<ReactTests.test_singleStopErrback.<locals>.ExpectedExceptioni„  r$   Nr%   r$   r   r   r  r'  „  r  r   r  c                 ó´   >• U R                   " SU R                  5        [        R                  " 5       nU R                  " SSUR
                  T" 5       5        U$ r  ©r;   r÷   r   r  rÐ  r{  r  s     €r   ræ  Ú/ReactTests.test_singleStopErrback.<locals>.main‡  sK   ø€ Ø×Ò˜a §¡Ô.Ü—~’~Ó'ˆHØ×)Ò)Ø˜* h×&6Ñ&6Ñ8IÓ8Kôð ˆOr   rè  r2   Nr  r
  s        @r   Útest_singleStopErrbackÚ!ReactTests.test_singleStopErrback}  s‡   ø€ ô	¤	ô 	õ	ô ‹NˆØ×%Ñ%¤j´$·*±*¸dÐ%ÐOˆ	à×Ñ˜˜IŸN™NÔ+à×Ñ˜Ÿ™› aÔ(Ø×'Ñ'Ð(9Ó:ˆØ×Ñœ˜V› aÕ(r   c                 óØ   ^• / mU4S jn[        5       nU R                  [        [        R                  U/ SQUS9nU R                  SUR                  5        U R                  T/ SQ5        g)úr
L{task.react} passes the elements of the list it is passed as
positional arguments to the function it is passed.
c                 óV   >• TR                  XU45        [        R                  " S 5      $ r   ©Úextendr   r÷  ©r   r�   ÚyÚzrÈ  s       €r   ræ  Ú'ReactTests.test_arguments.<locals>.mainŸ  s"   ø€ Ø�K‰K˜˜q˜	Ô"Ü—=’= Ó&Ð&r   ©r2   r9   rQ   rè  r   N©r½  rc   rë  r   rì  r+   rí  ©r   ræ  rï  rð  rÈ  s       @r   Útest_argumentsÚReactTests.test_arguments˜  sb   ø€ ð
 ˆõ	'ô ‹NˆØ×%Ñ%ÜœŸ
™
 Dª)¸að &ð 
ˆ	ð 	×Ñ˜˜IŸN™NÔ+Ø×Ñ˜šyÕ)r   c                 ó@  ^ • U 4S jn[        5       n[        5          [        U5        T R                  [        [
        R                  U/ 5      nT R                  SUR                  5        SSS5        T R                  UT R                  5        g! , (       d  f       N+= f)úX
L{twisted.internet.reactor} is used if no reactor argument is passed to
L{task.react}.
c                 ó>   >• U Tl         [        R                  " S 5      $ r   ©ÚpassedReactorr   r÷  ©r   r   s    €r   ræ  Ú,ReactTests.test_defaultReactor.<locals>.main°  s   ø€ Ø!(ˆDÔÜ—=’= Ó&Ð&r   r   N©r½  r	   r   rc   rë  r   rì  r+   rí  r%  r?  ©r   ræ  r   rð  s   `   r   Útest_defaultReactorÚReactTests.test_defaultReactorª  so   ø€ õ	'ô “.ˆÜ�[Ü˜7Ô#Ø×)Ñ)¬*´d·j±jÀ$ÈÓKˆIØ×Ñ˜Q 	§¡Ô/÷ ð 	�‰�g˜t×1Ñ1Õ2÷	 �[úó   œABÂ
Bc                 ó    • S n[        5       nU R                  [        [        R                  U/ US9nU R                  SUR                  5        g)út
L{task.react} forwards the exit code specified by the C{SystemExit}
error returned by the passed function, if any.
c                 ó@   • [         R                  " [        S5      5      $ ©Né   ©r   r  rë  rø  s    r   ræ  Ú1ReactTests.test_exitWithDefinedCode.<locals>.mainÁ  s   € Ü—:’:œj¨›nÓ-Ð-r   rè  rK  Nr7  rú  s       r   Útest_exitWithDefinedCodeÚ#ReactTests.test_exitWithDefinedCode»  sD   € ò	.ô ‹NˆØ×%Ñ%¤j´$·*±*¸dÀBÐQRÐ%ÐSˆ	Ø×Ñ˜˜YŸ^™^Õ,r   c                 ó    • S n[        5       nU R                  [        [        R                  U/ US9nU R                  SUR                  5        g)ú_
L{task.react} handles when the reactor is stopped just before the
returned L{Deferred} fires.
c                 óf   ^ ^• [         R                  " 5       mUU 4S jnT R                  " U5        T$ )Nc                  óJ   >• TR                   " 5         T R                  S 5        g r   ©r÷   r  ©r  r   s   €€r   r÷   Ú;ReactTests.test_synchronousStop.<locals>.main.<locals>.stopÑ  ó   ø€ Ø—’”Ø—
‘
˜4Õ r   ©r   r  rÊ  ©r   r÷   r  s   ` @r   ræ  Ú-ReactTests.test_synchronousStop.<locals>.mainÎ  s)   ù€ Ü—’Ó ˆAö!ð ×#Ò# DÔ)ØˆHr   rè  r   Nr7  rú  s       r   Útest_synchronousStopÚReactTests.test_synchronousStopÈ  sD   € ò	ô ‹NˆØ×%Ñ%¤j´$·*±*¸dÀBÐQRÐ%ÐSˆ	Ø×Ñ˜˜IŸN™NÕ+r   c                 ó    • S n[        5       nU R                  [        [        R                  U/ US9nU R                  SUR                  5        g)ú^
L{task.react} handles when the reactor is stopped and the
returned L{Deferred} doesn't fire.
c                 óf   • U R                   " SU R                  5        [        R                  " 5       $ r–  ©r;   r÷   r   r  rø  s    r   ræ  Ú.ReactTests.test_asynchronousStop.<locals>.mainâ  s#   € Ø×Ò˜a §¡Ô.Ü—>’>Ó#Ð#r   rè  r   Nr7  rú  s       r   Útest_asynchronousStopÚ ReactTests.test_asynchronousStopÜ  sD   € ò	$ô ‹NˆØ×%Ñ%¤j´$·*±*¸dÀBÐQRÐ%ÐSˆ	Ø×Ñ˜˜IŸN™NÕ+r   ©r?  N©r   r   r   r   r³   rñ  rû  r  r  r"  r+  r9  rD  rN  r[  rb  r   r$   r   r   rÝ  rÝ    ó>   † ñò)ò&)ò)ò.)ò(,ò&)ò6*ò$3ò"-ò,õ(,r   rÝ  c                   óZ   • \ rS rSrSrS rS rS rS rS r	S r
S	 rS
 rS rS rS rSrg)ÚReactCoroutineFunctionTestsië  zH
Tests for L{twisted.internet.task.react} with an C{async def} argument
c                 ó  ^• / mU4S jn[        5       nU R                  [        [        R                  XS9nU R                  SUR                  5        U R                  TS/5        U R                  UR                  5       S5        g)rß  c              “   óÆ   >#   • [         R                  " 5       nU R                  " STR                  S5        U R                  " SUR                  S 5        UI S h  v•N $  N7frá  râ  rã  s     €r   ræ  ÚEReactCoroutineFunctionTests.test_runsUntilAsyncCallback.<locals>.main÷  sL   øé € Ü—~’~Ó'ˆHØ×Ò˜a ×!2Ñ!2°DÔ9Ø×Ò˜a ×!2Ñ!2°DÔ9Ø!—>Ð!‘>ùs   ƒAA!ÁAÁA!rè  r   Tr9   Nrê  rî  s       @r   rñ  Ú7ReactCoroutineFunctionTests.test_runsUntilAsyncCallbackð  so   ø€ ð
 ˆ
õ	"ô ‹NˆØ×%Ñ%¤j´$·*±*¸dÐ%ÐOˆ	Ø×Ñ˜˜IŸN™NÔ+Ø×Ñ˜ d VÔ,Ø×Ñ˜Ÿ™› aÕ(r   c                 óÜ   • S n[        5       nU R                  [        [        R                  XS9nU R                  SUR                  5        U R                  UR                  5       S5        g)rô  c              “   óJ   #   • [         R                  " S 5      I S h  v•N $  N7fr   rö  rø  s    r   ræ  ÚDReactCoroutineFunctionTests.test_runsUntilSyncCallback.<locals>.main
  s   é € ÜŸš tÓ,×,Ð,Ñ,ùs   ‚#œ!�#rè  r   Nrê  rú  s       r   rû  Ú6ReactCoroutineFunctionTests.test_runsUntilSyncCallback  sU   € ò	-ô ‹NˆØ×%Ñ%¤j´$·*±*¸dÐ%ÐOˆ	Ø×Ñ˜˜IŸN™NÔ+Ø×Ñ˜Ÿ™› aÕ(r   c                 ó  ^•  " S S[         5      mU4S jn[        5       nU R                  [        [        R
                  XS9nU R                  SUR                  5        U R                  T5      nU R                  [        U5      S5        g)rþ  c                   ó   • \ rS rSrSrg)ÚQReactCoroutineFunctionTests.test_runsUntilAsyncErrback.<locals>.ExpectedExceptioni  r$   Nr%   r$   r   r   r  rs    r  r   r  c              “   ó”   >#   • [         R                  " 5       nU R                  " SUR                  T" 5       5        UI S h  v•N $  N7fr–  r  r  s     €r   ræ  ÚDReactCoroutineFunctionTests.test_runsUntilAsyncErrback.<locals>.main  s8   øé € Ü—~’~Ó'ˆHØ×Ò˜a ×!1Ñ!1Ñ3DÓ3FÔGØ!—>Ð!‘>ùs   ƒ>AÁAÁArè  r2   Nr  r
  s        @r   r  Ú6ReactCoroutineFunctionTests.test_runsUntilAsyncErrback  sq   ø€ ô	¤	ô 	õ	"ô
 ‹NˆØ×%Ñ%¤j´$·*±*¸dÐ%ÐOˆ	à×Ñ˜˜IŸN™NÔ+à×'Ñ'Ð(9Ó:ˆØ×Ñœ˜V› aÕ(r   c                 óZ  ^•  " S S[         5      mU4S jn[        5       nU R                  [        [        R
                  XS9nU R                  SUR                  5        U R                  UR                  5       S5        U R                  T5      nU R                  [        U5      S5        g)r  c                   ó   • \ rS rSrSrg)ÚPReactCoroutineFunctionTests.test_runsUntilSyncErrback.<locals>.ExpectedExceptioni0  r$   Nr%   r$   r   r   r  ry  0  r  r   r  c              “   óV   >#   • [         R                  " T" 5       5      I S h  v•N $  N7fr   r  r  s    €r   ræ  ÚCReactCoroutineFunctionTests.test_runsUntilSyncErrback.<locals>.main3  s   øé € ÜŸšÑ$5Ó$7Ó8×8Ð8Ñ8ùs   ƒ)¢'£)rè  r2   r   Nr  r
  s        @r   r  Ú5ReactCoroutineFunctionTests.test_runsUntilSyncErrback)  s‡   ø€ ô	¤	ô 	õ	9ô ‹NˆØ×%Ñ%¤j´$·*±*¸dÐ%ÐOˆ	Ø×Ñ˜˜IŸN™NÔ+Ø×Ñ˜Ÿ™› aÔ(Ø×'Ñ'Ð(9Ó:ˆØ×Ñœ˜V› aÕ(r   c                 óÜ   • S n[        5       nU R                  [        [        R                  XS9nU R                  UR                  5       S5        U R                  SUR                  5        g)r  c              “   óÄ   #   • U R                   " SU R                  5        [        R                  " 5       nU R                  " SSUR
                  S 5        UI S h  v•N $  N7fr  r  r  s     r   ræ  ÚAReactCoroutineFunctionTests.test_singleStopCallback.<locals>.mainD  sJ   é € Ø×Ò˜a §¡Ô.Ü—~’~Ó'ˆHØ×)Ò)¨(°JÀ×@QÑ@QÐSWÔXØ!—>Ð!‘>ùs   ‚AA ÁAÁA rè  r2   r   Nr!  rú  s       r   r"  Ú3ReactCoroutineFunctionTests.test_singleStopCallback=  sU   € ò	"ô ‹NˆØ×%Ñ%¤j´$·*±*¸dÐ%ÐOˆ	Ø×Ñ˜Ÿ™› aÔ(à×Ñ˜˜IŸN™NÕ+r   c                 óZ  ^•  " S S[         5      mU4S jn[        5       nU R                  [        [        R
                  XS9nU R                  SUR                  5        U R                  UR                  5       S5        U R                  T5      nU R                  [        U5      S5        g)r%  c                   ó   • \ rS rSrSrg)ÚMReactCoroutineFunctionTests.test_singleStopErrback.<locals>.ExpectedExceptioniW  r$   Nr%   r$   r   r   r  rƒ  W  r  r   r  c              “   óÐ   >#   • U R                   " SU R                  5        [        R                  " 5       nU R                  " SSUR
                  T" 5       5        UI S h  v•N $  N7fr  r)  r  s     €r   ræ  Ú@ReactCoroutineFunctionTests.test_singleStopErrback.<locals>.mainZ  sS   øé € Ø×Ò˜a §¡Ô.Ü—~’~Ó'ˆHØ×)Ò)Ø˜* h×&6Ñ&6Ñ8IÓ8Kôð "—>Ð!‘>ùs   ƒAA&ÁA$Á A&rè  r2   Nr  r
  s        @r   r+  Ú2ReactCoroutineFunctionTests.test_singleStopErrbackP  s‡   ø€ ô	¤	ô 	õ	"ô ‹NˆØ×%Ñ%¤j´$·*±*¸dÐ%ÐOˆ	à×Ñ˜˜IŸN™NÔ+à×Ñ˜Ÿ™› aÔ(Ø×'Ñ'Ð(9Ó:ˆØ×Ñœ˜V› aÕ(r   c                 óØ   ^• / mU4S jn[        5       nU R                  [        [        R                  U/ SQUS9nU R                  SUR                  5        U R                  T/ SQ5        g)r.  c              “   ór   >#   • TR                  XU45        [        R                  " S 5      I S h  v•N $  N7fr   r0  r2  s       €r   ræ  Ú8ReactCoroutineFunctionTests.test_arguments.<locals>.mainr  s+   øé € Ø�K‰K˜˜q˜	Ô"ÜŸš tÓ,×,Ð,Ñ,ùs   ƒ-7°5±7r6  rè  r   Nr7  r8  s       @r   r9  Ú*ReactCoroutineFunctionTests.test_argumentsk  sb   ø€ ð
 ˆõ	-ô ‹NˆØ×%Ñ%ÜœŸ
™
 Dª)¸að &ð 
ˆ	ð 	×Ñ˜˜IŸN™NÔ+Ø×Ñ˜šyÕ)r   c                 ó@  ^ • U 4S jn[        5       n[        5          [        U5        T R                  [        [
        R                  U/ 5      nT R                  SUR                  5        SSS5        T R                  UT R                  5        g! , (       d  f       N+= f)r<  c              “   óZ   >#   • U Tl         [        R                  " S 5      I S h  v•N $  N7fr   r>  r@  s    €r   ræ  Ú=ReactCoroutineFunctionTests.test_defaultReactor.<locals>.mainƒ  s#   øé € Ø!(ˆDÔÜŸš tÓ,×,Ð,Ñ,ùs   ƒ!+¤)¥+r   NrB  rC  s   `   r   rD  Ú/ReactCoroutineFunctionTests.test_defaultReactor}  so   ø€ õ	-ô “.ˆÜ�[Ü˜7Ô#Ø×)Ñ)¬*´d·j±jÀ$ÈÓKˆIØ×Ñ˜Q 	§¡Ô/÷ ð 	�‰�g˜t×1Ñ1Õ2÷	 �[úrF  c                 ó    • S n[        5       nU R                  [        [        R                  U/ US9nU R                  SUR                  5        g)rH  c              “   ó\   #   • [         R                  " [        S5      5      I S h  v•N $  N7frJ  rL  rø  s    r   ræ  ÚBReactCoroutineFunctionTests.test_exitWithDefinedCode.<locals>.main”  s   é € ÜŸš¤J¨r£NÓ3×3Ð3Ñ3ùs   ‚#,¥*¦,rè  rK  Nr7  rú  s       r   rN  Ú4ReactCoroutineFunctionTests.test_exitWithDefinedCodeŽ  sD   € ò	4ô ‹NˆØ×%Ñ%¤j´$·*±*¸dÀBÐQRÐ%ÐSˆ	Ø×Ñ˜˜YŸ^™^Õ,r   c                 ó    • S n[        5       nU R                  [        [        R                  U/ US9nU R                  SUR                  5        g)rQ  c              “   ó‚   ^ ^#   • [         R                  " 5       mUU 4S jnT R                  " U5        TI S h  v•N $  N7f)Nc                  óJ   >• TR                   " 5         T R                  S 5        g r   rT  rU  s   €€r   r÷   ÚLReactCoroutineFunctionTests.test_synchronousStop.<locals>.main.<locals>.stop¤  rW  r   rX  rY  s   ` @r   ræ  Ú>ReactCoroutineFunctionTests.test_synchronousStop.<locals>.main¡  s0   ùé € Ü—’Ó ˆAö!ð ×#Ò# DÔ)Ø—7ˆN‘7ùs   „4?¸=¹?rè  r   Nr7  rú  s       r   r[  Ú0ReactCoroutineFunctionTests.test_synchronousStop›  sD   € ò	ô ‹NˆØ×%Ñ%¤j´$·*±*¸dÀBÐQRÐ%ÐSˆ	Ø×Ñ˜˜IŸN™NÕ+r   c                 ó    • S n[        5       nU R                  [        [        R                  U/ US9nU R                  SUR                  5        g)r^  c              “   ó‚   #   • U R                   " SU R                  5        [        R                  " 5       I S h  v•N $  N7fr–  r`  rø  s    r   ræ  Ú?ReactCoroutineFunctionTests.test_asynchronousStop.<locals>.mainµ  s,   é € Ø×Ò˜a §¡Ô.ÜŸšÓ)×)Ð)Ñ)ùs   ‚6?¸=¹?rè  r   Nr7  rú  s       r   rb  Ú1ReactCoroutineFunctionTests.test_asynchronousStop¯  sD   € ò	*ô ‹NˆØ×%Ñ%¤j´$·*±*¸dÀBÐQRÐ%ÐSˆ	Ø×Ñ˜˜IŸN™NÕ+r   rd  Nre  r$   r   r   rh  rh  ë  rf  r   rh  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_  rŸ  r½  ÚSynchronousTestCaserÝ  rh  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   