+
    Dfj                        R t ^ RIHtHtHtHtHt ^ RIHt ^ RI	H
t
 ^ RIHt ]P                  t^ RIHt  ! R R]P                   4      t ! R R	]4      t ! R
 R]P(                  4      t ! R R]P(                  4      t ! R R]P(                  4      t ! R R]P(                  4      t ! R R4      t ! R R]P4                  4      t ! R R]P4                  4      tR# )z%
Tests for L{twisted.internet.task}.
)defererror
interfacesreactortask)installReactor)	NoReactor)unittest)failurec                   2   a a ] tR t^t oV 3R ltRtVtV ;t# )TestableLoopingCallc                4   < \         SV `  ! V/ VB  Wn        R # N)super__init__clock)selfr   akw	__class__s   &&*,8/usr/lib/python3/dist-packages/twisted/test/test_task.pyr   TestableLoopingCall.__init__   s    !"r"
    )r   )__name__
__module____qualname____firstlineno__r   __static_attributes____classdictcell____classcell__)r   __classdict__s   @@r   r   r      s      r   r   c                       ] tR t^tRtR# )TestException Nr   r   r   r   r   r#   r   r   r"   r"      s    r   r"   c                   ~   a  ] tR t^t o RtR tR tR tR tR t	R t
R tR	 tR
 tR tR tR tR tR tR tRtV tR# )
ClockTestsz4
Test the non-wallclock based clock implementation.
c                p    \         P                  ! 4       pV P                  VP                  4       ^ 4       R# )zF
Test that the C{seconds} method of the fake clock returns fake time.
N)r   ClockassertEqualsecondsr   cs   & r   testSecondsClockTests.testSeconds#   s%     JJLa(r   c                6   \         P                  ! 4       pVP                  ^R ^^R7      pV P                  \        P
                  P                  V4      4       V P                  VP                  4       ^4       V P                  VP                  4       4       R# )zc
Test that calls can be scheduled for later with the fake clock and
hands back an L{IDelayedCall}.
c                     R # r   r#   r   bs   &&r   <lambda>*ClockTests.testCallLater.<locals>.<lambda>0       4r   r2   N)
r   r(   	callLater
assertTruer   IDelayedCall
providedByr)   getTimeactiver   r,   calls   &  r   testCallLaterClockTests.testCallLater*   sk    
 JJL{{1/a{8
//::4@A+&r   c                    \         P                  ! 4       pVP                  ^R ^^R7      pVP                  4        V P	                  VP                  4       4       R# )z#
Test that calls can be cancelled.
c                     R # r   r#   r1   s   &&r   r3   3ClockTests.testCallLaterCancelled.<locals>.<lambda>:   r5   r   r6   N)r   r(   r7   cancelassertFalser<   r=   s   &  r   testCallLaterCancelled!ClockTests.testCallLaterCancelled5   sC     JJL{{1/a{8'r   c                    \         P                  ! 4       pVP                  ^
R ^^R7      pVP                  ^R ^^R7      pV P                  W#J 4       R# )zC
Test that the DelayedCall returned is not one previously
created.
c                     R # r   r#   r1   s   &&r   r3   3ClockTests.test_callLaterOrdering.<locals>.<lambda>D   s    Tr   r6   c                     R # r   r#   r1   s   &&r   r3   rJ   E   s    Dr   N)r   r(   r7   rE   )r   r,   call1call2s   &   r   test_callLaterOrdering!ClockTests.test_callLaterOrdering>   sM    
 JJLB 11:A0!q9(r   c                .  a . o\         P                  ! 4       pVP                  ^V3R l4      pVP                  ^4       V P	                  S. 4       VP                  ^4       V P	                  SR.4       V P                  VP                  4       4       R# )z5
Test that advancing the clock will fire some calls.
c                  &   < S P                  R 4      # r   append)eventss   r   r3   (ClockTests.testAdvance.<locals>.<lambda>N   s    fmmD&9r   N)r   r(   r7   advancer)   rE   r<   r   r,   r>   rT   s   &  @r   testAdvanceClockTests.testAdvanceH   sr     JJL{{19:			!$			!$('r   c                   a a \         P                  ! 4       pVV 3R lpVP                  ^V4      oVP                  ^4       R# )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                  \   < SP                  \        P                  S P                  4       R # r   )assertRaisesr   AlreadyCalledrD   )r>   r   s   r   cb(ClockTests.testAdvanceCancel.<locals>.cb_   s    e114;;?r   N)r   r(   r7   rV   )r   r,   r^   r>   s   f  @r   testAdvanceCancelClockTests.testAdvanceCancelU   s3     JJL	@ {{1b!			!r   c                X  a . o\         P                  ! 4       pVP                  ^V3R l^^R7      pVP                  ^4       V P	                  VP                  4       ^4       VP                  R4       V P	                  S. 4       VP                  R4       V P	                  SR.4       R# )z!
Test that calls can be delayed.
c                 (   < SP                  W34      # r   rR   r   r2   rT   s   &&r   r3   1ClockTests.testCallLaterDelayed.<locals>.<lambda>k       6==!+@r   r6   g      ?      ?N      )r   r(   r7   delayr)   r;   rV   rW   s   &  @r   testCallLaterDelayedClockTests.testCallLaterDelayede   s     JJL{{1@!q{I

1+			#$			#&*r   c                z  a . o\         P                  ! 4       pVP                  ^V3R l^^R7      pVP                  ^4       VP	                  ^4       V P                  VP                  4       ^4       VP                  ^4       V P                  S. 4       VP                  ^4       V P                  SR.4       R# )z<
Test that calls can have their time reset to a later time.
c                 (   < SP                  W34      # r   rR   rd   s   &&r   r3   4ClockTests.testCallLaterResetLater.<locals>.<lambda>y   rf   r   r6   Nrh   )r   r(   r7   rV   resetr)   r;   rW   s   &  @r   testCallLaterResetLater"ClockTests.testCallLaterResetLaters   s     JJL{{1@!q{I			!

1+			!$			!&*r   c                  a . o\         P                  ! 4       pVP                  ^V3R l^^R7      pVP                  ^4       V P	                  VP                  4       ^4       VP                  ^4       V P	                  SR.4       R# )z?
Test that calls can have their time reset to an earlier time.
c                 (   < SP                  W34      # r   rR   rd   s   &&r   r3   5ClockTests.testCallLaterResetSooner.<locals>.<lambda>   rf   r   r6   Nrh   )r   r(   r7   rq   r)   r;   rV   rW   s   &  @r   testCallLaterResetSooner#ClockTests.testCallLaterResetSooner   sj     JJL{{1@!q{I

1+			!&*r   c                    \         P                  ! 4       pVP                  ^R 4      pVP                  ^R 4      pVP                  4       pV P	                  W#0\        V4      4       R# )z2
Test that we can get a list of all delayed calls
c                     R # r   r#   xs   &r   r3   1ClockTests.test_getDelayedCalls.<locals>.<lambda>       r   c                     R # r   r#   r{   s   &r   r3   r}      s    r   N)r   r(   r7   getDelayedCallsr)   set)r   r,   r>   rM   callss   &    r   test_getDelayedCallsClockTests.test_getDelayedCalls   sS     JJL{{1n-A~.!!#$E
3r   c                p    \         P                  ! 4       pV P                  VP                  4       . 4       R# )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(    
 JJL**,b1r   c                    \         P                  ! 4       pV P                  \        P                  P                  V4      R 4       R# )z#Clock does not provide IReactorTimeN)r   r(   r8   r   IReactorTimer:   r+   s   & r   test_providesIReactorTime$ClockTests.test_providesIReactorTime   s0    JJL##..q13X	
r   c                  aa . oRR	.p\         P                  ! 4       oVV3R lpSP                  RVR4      pVP                  R4       SP                  RVR4       SP	                  ^.^,          4       V P                  SV4       R# )
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".
r2          @r         @c                 F   < SP                  V SP                  4       34      # r   rS   r*   nr   results   &r   r3   <ClockTests.test_callLaterKeepsCallsOrdered.<locals>.<lambda>       FMM1emmo*>?r   rg   Nr2   r   r   r   r   r(   r7   rq   pumpr)   r   expectedlogtimecall_ar   r   s   &   @@r   test_callLaterKeepsCallsOrdered*ClockTests.test_callLaterKeepsCallsOrdered   st     
+

?gs3SWc*

A37*r   c                  aa . oRR	.p\         P                  ! 4       oVV3R lpSP                  RVR4      pSP                  RVR4       VP                  R4       SP	                  ^.^,          4       V P                  SV4       R# )
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".
r2   r   r   r   c                 F   < SP                  V SP                  4       34      # r   r   r   s   &r   r3   AClockTests.test_callLaterResetKeepsCallsOrdered.<locals>.<lambda>   r   r   rg   Nr   r   r   r   s   &   @@r   $test_callLaterResetKeepsCallsOrdered/ClockTests.test_callLaterResetKeepsCallsOrdered   st     
+

?gs3Wc*S

A37*r   c                "  aaa . oR
R.p\         P                  ! 4       oVV3R lpSP                  RVR4      oV3R lpSP                  RV4       SP                  RVR4       SP                  R.^
,          4       V P	                  SV4       R	# )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   r2   c                 F   < SP                  V SP                  4       34      # r   r   r   s   &r   r3   KClockTests.test_callLaterResetInsideCallKeepsCallsOrdered.<locals>.<lambda>   r   r   r   c                  *   < S P                  R 4       R# )r   N)rq   )call_bs   r   r   DClockTests.test_callLaterResetInsideCallKeepsCallsOrdered.<locals>.a   s    LLr   rg         ?N)r,   r   )r2   g      @)r   r(   r7   r   r)   )r   r   r   r   r   r   r   s   &   @@@r   .test_callLaterResetInsideCallKeepsCallsOrdered9ClockTests.test_callLaterResetInsideCallKeepsCallsOrdered   s}     
+

?gs3	 	QWc*

C52:*r   r#   N)r   r   r   r   __doc__r-   r?   rF   rN   rX   r`   rl   rr   rw   r   r   r   r   r   r   r   r   r    s   @r   r&   r&      sZ     )	'()( ++
+
42
+0+0+ +r   r&   c                      a  ] tR t^t o RtR tR tR tR tR t	R t
R tR	 tR
 tR tR tR tR tR tR tR tR tR tR tRtV tR# )	LoopTestszO
Tests for L{task.LoopingCall} based on a fake L{IReactorTime}
implementation.
c                t    \         P                  ! R 4      pV P                  VP                  \        4       R# )z7
L{LoopingCall}'s default clock should be the reactor.
c                      R # r   r#   r#   r   r   r3   -LoopTests.test_defaultClock.<locals>.<lambda>   r~   r   N)r   LoopingCallr)   r   r   )r   r>   s   & r   test_defaultClockLoopTests.test_defaultClock   s(     -W-r   c                  aaa . oRo\         P                  ! 4       oVVV3R lp\         P                  ! V4      pSVn        ^oVP	                  R4       V P                  S^ .4       V P                  SP                  4       S4       SP                  ^ 4       V P                  S^ .4       ^oSP                  R4       V P                  S^ R.4       V P                  SP                  4       R4       SP                  ^ 4       V P                  S^ R.4       ^ oSP                  R4       V P                  S. RO4       V P                  SP                  4       ^4       R# )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                  h   < SP                  SP                  4       4       SP                  S 4       R # r   )rS   r*   rV   )callDurationr   timess   r   	aCallback3LoopTests.test_callbackTimeSkips.<locals>.aCallback  s!    LL)MM,'r   r         @g      @)    r      )r   r(   r   r   startr)   r*   rV   )r   r   r>   r   r   r   s   &  @@@r   test_callbackTimeSkips LoopTests.test_callbackTimeSkips   s.    

	( 	*
 

3 	$ 	,7
 	a$ cC)#. 	aC) c,!,r   c                  aa . o\         P                  ! 4       oVV3R lp\         P                  ! V4      pSVn        VP	                  R4       V P                  S^ .4       SP                  ^4       V P                  S^ ^.4       SP                  ^4       V P                  S. RO4       SP                  ^ 4       V P                  S. RO4       R# )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                  F   < SP                  S P                  4       4       R # r   r   )r   r   s   r   r   2LoopTests.test_reactorTimeSkips.<locals>.aCallback;  s    LL)r   r   N)r   rj      )r   r(   r   r   r   r)   rV   )r   r   r>   r   r   s   &  @@r   test_reactorTimeSkipsLoopTests.test_reactorTimeSkips1  s     

	*
 	*


3 	$ 	aA' 	a	* 	a	*r   c                x  aa . o\         P                  ! 4       oVV3R lp\         P                  P                  V4      pSVn        RpRpVP                  V4       V P                  SR.4       SP                  W4,           4       V P                  SRW4,           ^3.4       SP                  ^V,          V,           4       V P                  SRW4,           ^3^V,          ^V,          ,           ^3.4       SP                  ^ 4       V P                  SRW4,           ^3^V,          ^V,          ,           ^3.4       R# )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                 J   < SP                  SP                  4       V 34       R # r   r   )numCallsr   r   s   &r   r   7LoopTests.test_reactorTimeCountSkips.<locals>.aCallback_  s    LL%--/845r   r   {Gz?Nr   ri   )r   r(   r   	withCountr   r   r)   rV   r   r   r>   INTERVALREALISTIC_DELAYr   r   s   &    @@r   test_reactorTimeCountSkips$LoopTests.test_reactorTimeCountSkipsS  s*    

	6
 )))4


8 	)
 	h01(*Da)H IJ 	q8|67+Q/h,1#67;	
 	a+Q/h,1#67;	
r   c                  aa . o\         P                  ! 4       oVV3R lp\         P                  P                  V4      pSVn        RpRpVP                  V4       V P                  SP                  4       R	4       SP                  W4,           4       V P                  SP                  4       W4,           ^34       SP                  VR,          4       V P                  SP                  4       RV,          V,           ^34       SP                  VR,          4       V P                  SP                  4       RV,          V,           ^34       R# )
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                 J   < SP                  SP                  4       V 34       R # r   r   )countr   r   s   &r   r   <LoopTests.test_countLengthyIntervalCounts.<locals>.aCallback  s    LL%--/512r   r   r   g      ?g      @g      ?r   Nr   )	r   r(   r   r   r   r   r)   poprV   r   s   &    @@r   test_countLengthyIntervalCounts)LoopTests.test_countLengthyIntervalCounts  s     

	3
 )))4


8f- 	h01x'A1&EF 	ho&x?'JA&NO 	ho&h/'I1&MNr   c                R   \         P                  ! 4       p. p\         P                  P                  VP                  4      pWn        ^
pRpWT,          pVP                  VRR7       \        V4       F  pVP                  V4       K  	  R pWX! V.V,          4      ,
          p	VP                  V	4       VP                  4       p
V P                  \        V	4      R8  V	 R24       V P                  W8  V
 RV 24       V P                  V! V4      V4       V P                  ^ V4       R# )	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.
rg   Fnowc                ,    RpV  F  pW,          pK  	  V# )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_compatALoopTests.test_withCountFloatingPointBoundary.<locals>.sum_compat  s     E Lr   r   z should be greater than zeroz$ should be greater than or equal to N)r   r(   r   r   rS   r   r   rangerV   r*   r8   absr)   assertNotIn)r   r   accumulatorr>   r   timespanintervalr|   r   epsilonsecondsValues   &          r   #test_withCountFloatingPointBoundary-LoopTests.test_withCountFloatingPointBoundary  s    

))+*<*<=

  #

8
'uAMM(# 
	 Z
U(:;;g}} 	Gs*wi7S,TU 	$n@
K	

 	K0%8K(r   c                @  aa \         P                  ! 4       p. oVV3R lp\         P                  P                  V4      oVSn        SP                  ^ RR7      pVP                  ^ .^,          4       V P                  V4       V P                  ^.^,          S4       R# )za
L{task.LoopingCall.withCount} with interval set to 0 calls the
countCallable with a count of 1.
c                 n   < SP                  V 4       \        S4      ^8  d   SP                  4        R# R# )r   NrS   lenstop)cntr   loops   &r   foo1LoopTests.test_withCountIntervalZero.<locals>.foo   s,    s#;!#		 $r   Fr   N)	r   r(   r   r   r   r   r   successResultOfr)   )r   r   r   deferredr   r   s   &   @@r   test_withCountIntervalZero$LoopTests.test_withCountIntervalZero  s    
 

	
 ))#.
::aU:+ 	

A37X&!q+.r   c                :  aaa \         P                  ! 4       p\        P                  ! 4       o. oVVV3R lp\         P                  P                  V4      oVSn        SP                  ^ RR7       VP                  ^ .^,          4       V P                  ^.^,          S4       VP                  ^.^,          4       V P                  ^.^,          S4       SP                  R4       VP                  ^ .^,          4       V P                  ^.^,          S4       R# )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                    < SP                  V 4       \        S4      ^8X  d   S# \        S4      ^8  d   SP                  4        R# R# )rj   Nr   )r   r   r   r   s   &r   r   6LoopTests.test_withCountIntervalZeroDelay.<locals>.foo  s>    s#;1$;!#		 $r   Fr   N)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%
 

A37!q+. 	

A37!q+. 	$

A37!q+.r   c                  a	a
a \         P                  ! 4       p\        P                  ! 4       o
. o	^o^p^p^	pW$,           pWS,          pV^,          pV	V
V3R lp\         P                  P                  V4      pWn        VP                  ^ RR7       VP                  ^.SV,           ,          4       V P                  ^.S,          S	4       W8n
        S
P                  R4       VP                  V4       V P                  ^^V.S	4       VP                  ^V,          4       V P                  ^^V^.S	4       VP                  ^V,          4       V P                  ^^V^^.S	4       R# )z
L{task.LoopingCall.withCount} with interval set to 0 will still keep
the time when last called so when the interval is reset.
c                 N   < SP                  V 4       \        S4      S8X  d   S# R # r   rS   r   )r   r   r   stepsBeforeDelays   &r   r   ILoopTests.test_withCountIntervalZeroDelayThenNonZeroInterval.<locals>.foob  s)    s#;#33 4r   Fr   N)r   r(   r   r  r   r   r   r   r   r)   r   r  rV   )r   r   extraTimeAfterDelaymutatedLoopIntervaldurationOfDelayskippedTimeexpectedSkipCountr   r   r   r   r  s   &        @@@r   2test_withCountIntervalZeroDelayThenNonZeroInterval<LoopTests.test_withCountIntervalZeroDelayThenNonZeroInterval8  s[   
 

>># 
     
 *; (> 	Q	 
 ))#.


1%
  	

A3*-@@AB!//= ,$o&!Q 12K@a--.!Q 115{Ca--.!Q 11a8+Fr   c                l  aa . R
Op\         P                  ! 4       p. oRV3R llp\        W#RRRR7      pVP                  R4      p. oV3R lpVP	                  V4       VP                  V4       V P                  \        S4      ^R	\        S4      3,          4       S FM  w  rxrV P                  VR4       V P                  VR4       V P                  V	4       V P                  V
R4       KO  	  VP                  4        V P                  S^ ,          V4       V P                  VP                  4       R# )皙?皙?Nc                 .   < SP                  WW#34       R # r   rR   )r   r2   r,   dLs   &&&&r   r   (LoopTests.testBasicFunction.<locals>.foo  s    HHaA\"r   r   r2   r  r  c                 *   < SP                  V 4       R # r   rR   r   	theResults   &r   
saveResult/LoopTests.testBasicFunction.<locals>.saveResult      V$r   zgot %d iterations, not 3r  r  r  )NN)r   r(   r   r   addCallbackr   r)   r   assertIsNoner   assertIsrE   r   )r   timingsr   r   lcDr  r   r2   r,   r  r  r  s   &          @@r   testBasicFunctionLoopTests.testBasicFunction  s   
 #

	# !S#=HHSM		% 	
j!

7Q$>#a&$JKJA!Q$Q$a Q$	  		ilB' 	%r   c                  a . ROp\         P                  ! 4       p. p\        W#P                  R4      pVP	                  RRR7      p. oV3R lpVP                  V4       VP                  V4       V P                  \        V4      ^R\        V4      3,          4       VP                  4        V P                  S^ ,          V4       V P                  VP                  4       R# )r  r  NFr   c                 *   < SP                  V 4       R # r   rR   r  s   &r   r  .LoopTests.testDelayedStart.<locals>.saveResult  r  r   zgot %d iterations, not 2r  )r   r(   r   rS   r   r   r   r)   r   r   r"  rE   r   )r   r#  r   r  r$  r  r  r  s   &      @r   testDelayedStartLoopTests.testDelayedStart  s    "

 $7HHSeH$		% 	
j!

7Q$>#a&$JK
	ilB'%r   c                v    \         P                  ! R  4      pV P                  \        VP                  R4       R# )c                      R # r   r#   r#   r   r   r3   (LoopTests.testBadDelay.<locals>.<lambda>  s    dr   N)r   r   r\   
ValueErrorr   )r   r$  s   & r   testBadDelayLoopTests.testBadDelay  s(    l+*bhh3r   c                   a . oV3R  lp\         P                  ! 4       p\        W24      pVP                  VRR7       VP	                  4        V P                  S4       V P                  VP                  4       R# )c                  *   < S P                  R 4       R # r   rR   rans   r   r   $LoopTests._stoppingTest.<locals>.foo      JJtr   Fr   N)r   r(   r   r   r   rE   r   )r   rk   r   r   r$  r7  s   &&   @r   _stoppingTestLoopTests._stoppingTest  s]    	 

 ,
E"
	%r   c                $    V P                  ^ 4      # )r   r:  r   s   &r   testStopAtOnceLoopTests.testStopAtOnce  s    !!!$$r   c                $    V P                  ^
4      # )
   r=  r>  s   &r   testStoppingBeforeDelayedStart(LoopTests.testStoppingBeforeDelayedStart  s    !!"%%r   c                N  a . oV3R lp\         P                  ! 4       p\        W!4      pVP                  ^RR7       VP	                  ^4       VP                  4        VP	                  ^4       V P                  S. 4       VP	                  ^4       V P                  SR.4       R# )z(
Test that L{LoopingCall} can be reset.
c                  *   < S P                  R 4       R # r   rR   r6  s   r   r   !LoopTests.test_reset.<locals>.foo  r9  r   Fr   N)r   r(   r   r   rV   rq   r)   )r   r   r,   r$  r7  s   &   @r   
test_resetLoopTests.test_reset  s     	 JJL (
			!

			!b!			!tf%r   c           
     r    V P                  \        \        P                  ! \        ^^R7      4      R4       R# )z?
L{LoopingCall.__repr__} includes the wrapped function's name.
)keyz6LoopingCall<None>(installReactor, *(1,), **{'key': 2})N)r)   reprr   r   r   r>  s   &r   test_reprFunctionLoopTests.test_reprFunction  s,     	!!.!;<D	
r   c                    V P                  \        \        P                  ! \        P
                  4      4      R4       R# )zB
L{LoopingCall.__repr__} includes the wrapped method's full name.
z:LoopingCall<None>(TestableLoopingCall.__init__, *(), **{})N)r)   rL  r   r   r   r   r>  s   &r   test_reprMethodLoopTests.test_reprMethod  s/     	!!"5">">?@H	
r   c                D   \         P                  ! R 4      pVP                   RpV P                  V P                  .4      pV P                  ^\        V4      4       V P                  \        V^ ,          R,          4       V P                  W#^ ,          R,          4       R# )z(
L{LoopingCall.deferred} is deprecated.
c                      R # r   r#   r#   r   r   r3   4LoopTests.test_deferredDeprecation.<locals>.<lambda>  r~   r   ztwisted.internet.task.LoopingCall.deferred was deprecated in Twisted 16.0.0; please use the deferred returned by start() insteadcategorymessageN)r   r   r   flushWarningstest_deferredDeprecationr)   r   DeprecationWarning)r   r   rV  warningss   &   r   rX  "LoopTests.test_deferredDeprecation  s     -B 	
 %%t'D'D&EFCM*+Xa[-DE1+i"89r   r#   N)r   r   r   r   r   r   r   r   r   r   r   r   r  r  r&  r+  r2  r:  r?  rC  rH  rM  rP  rX  r   r   r   s   @r   r   r      sz     
.2-h +D8
t'OR@)D/4$/LGGR&&P&04
&%&&&

: :r   r   c                   P   a  ] tR tRt o R tR tR tR tR tR t	R t
R	 tR
tV tR# )ReactorLoopTestsi  c                    R  p\         P                  ! VR4      pV P                  VP                  R4      \        4      # )c                     \        V 4      h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    	# c5)!!"((3-??r   c                   a V3R  lp\         P                  ! VR4      oV P                  SP                  R4      \        4      # )c                 :   < SP                  4        \        V 4      hr   )r   r"   )r|   r$  s   &r   r   -ReactorLoopTests.testFailAndStop.<locals>.foo  s    GGI""r   rb  r  rc  re  s   & @r   testFailAndStop ReactorLoopTests.testFailAndStop  s7    	# c5)!!"((3-??r   c                   a aa . oVV3R  lp\         P                  ! V4      oSP                  ^ 4      pVV 3R lpVP                  V4      # )c                  n   < SP                  R 4       \        S4      ^8  d   S P                  4        R # R # r   r   )r$  r7  s   r   r   0ReactorLoopTests.testEveryIteration.<locals>.foo&  s(    JJt3x!|	 r   c                 >   < SP                  \        S4      ^4       R# )   N)r)   r   )ignr7  r   s   &r   stopped4ReactorLoopTests.testEveryIteration.<locals>.stopped.  s    SXq)r   )r   r   r   r   )r   r   r  rs  r$  r7  s   f   @@r   testEveryIteration#ReactorLoopTests.testEveryIteration#  sB    	
 c"HHQK	* }}W%%r   c                   a \         P                  ! 4       oV3R  lp\        P                  ! V4      V n        V P                  P                  ^RR7       \        P                  ! ^ V P                  S4       S# )c                  R   < S P                  \        P                  ! R 4      4       R# )z'This task also should never get called.N)errbackr
   DefaultExceptionr  s   r   r   1ReactorLoopTests.testStopAtOnceLater.<locals>.foo8  s    II(()RSr   Fr   )	r   r  r   r   _lcr   r   r7   !_callback_for_testStopAtOnceLater)r   r   r  s   & @r   testStopAtOnceLater$ReactorLoopTests.testStopAtOnceLater3  s[     NN	
 ##C(qe$!TCCQGr   c                ~    V P                   P                  4        \        P                  ! ^ VP                  R4       R# )r   successN)r|  r   r   r7   r  )r   r  s   &&r   r}  2ReactorLoopTests._callback_for_testStopAtOnceLaterB  s%    !QZZ3r   c                   aa R R.p\         P                  ! 4       oVV3R lp\        SV4      oSP                  R 4       SP	                  V4       V P                  SP                  4       R# )皙?g?c                     < \         P                  ! 4       p V P                  V3R  l4       SP                  ^V P                  R4       V # )c                 $   < SP                  4       # r   )r   )_r$  s   &r   r3   @ReactorLoopTests.testWaitDeferred.<locals>.foo.<locals>.<lambda>N  s    BGGIr   N)r   r  r   r7   r  )r  r   r$  s    r   r   .ReactorLoopTests.testWaitDeferred.<locals>.fooL  s5     AMM-.OOAqzz40Hr   N)r   r(   r   r   r   rE   r   )r   r#  r   r   r$  s   &  @@r   testWaitDeferred!ReactorLoopTests.testWaitDeferredF  sU     *

	 !,


7%r   c                  a R .p\         P                  ! 4       oV3R lp\        SV4      pVP                  ^4      pV P	                  V\
        4       SP                  V4       V P                  SP                  4       V# )333333?c                  |   < \         P                  ! 4       p SP                  R V P                  \	        4       4       V # )r  )r   r  r7   ry  r"   )r  r   s    r   r   4ReactorLoopTests.testFailurePropagation.<locals>.fooa  s*     AOOCMO<Hr   )	r   r(   r   r   rd  r"   r   rE   r   )r   r#  r   r$  r  r   s   &    @r   testFailurePropagation'ReactorLoopTests.testFailurePropagationW  sj     %

	
 !,HHQK1m,

7%r   c                  aa \         P                  ! 4       p\        P                  ! 4       o. oVV3R lp\         P                  P                  V4      pWn        VP                  RRR7      oV P                  S. 4       VP                  RR.4       V P                  \        S4      ^4       SP                  R4       VP                  R.4       V P                  \        S4      ^4       V P                  S^^.4       R# )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                 N   < SP                  V 4       \        S4      ^8X  d   S# R# ri   Nr  )possibleCountr  deferredCountss   &r   countTracker=ReactorLoopTests.test_deferredWithCount.<locals>.countTrackerz  s&    !!-0>"a'r   r  Fr   g?N)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     JJL	NN	 ''5HHSeH$ 	, 	Sz"^,a0 	


4u^,a0 	!Q0r   )r|  N)r   r   r   r   rf  rk  ru  r~  r}  r  r  r  r   r   r   s   @r   r]  r]    s4     @@& 4&".*1 *1r   r]  c                   <   a  ] tR tRt o RtR tR tR tR tRt	V t
R# )	DeferLaterTestsi  z
Tests for L{task.deferLater}.
c                V  aa . o\        4       oVV3R lp\        P                  ! 4       p\        P                  ! V^VRRR7      pVP	                  V P
                  S4       VP                  ^4       V P                  S. 4       VP                  ^4       V P                  SR.4       V# )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                 ,   < SP                  W34       S# r   rR   )r   rb  flagresultss   &&r   callable/DeferLaterTests.test_callback.<locals>.callable  s    NNC:&Kr   r   rb  )rb  )r   rb  )objectr   r(   
deferLaterr   r"  rV   r)   )r   r  r   r  r  r  s   &   @@r   test_callbackDeferLaterTests.test_callback  s    
 x	 

OOE1h5A	dmmT*a"%a>"23r   c                    R p\         P                  ! 4       p\         P                  ! V^V4      pVP                  ^4       V P	                  V\
        4      # )zk
The L{Deferred} returned by L{task.deferLater} is errbacked if the
supplied function raises an exception.
c                      \        4       hr   r`  r#   r   r   r  .DeferLaterTests.test_errback.<locals>.callable  s
    /!r   )r   r(   r  rV   rd  r"   )r   r  r   r  s   &   r   test_errbackDeferLaterTests.test_errback  sE    	" 

OOE1h/a!!!]33r   c                  a aa . o\         P                  ! 4       o\         P                  ! S^SP                  R4      pVP	                  4        VVV 3R lpS P                  V\        P                  4       VP                  V4       V# )zt
The L{Deferred} returned by L{task.deferLater} can be
cancelled to prevent the call from actually being performed.
Nc                 j   < SP                  . SP                  4       4       SP                  S4       R # r   )r)   r   rE   )ignoredcalledr   r   s   &r   cbCancelled0DeferLaterTests.test_cancel.<locals>.cbCancelled  s*    R!6!6!89V$r   )	r   r(   r  rS   rD   rd  r   CancelledErrorr   )r   r  r  r  r   s   f  @@r   test_cancelDeferLaterTests.test_cancel  sd    
 

OOE1fmmT:	
	% 	1e223	k"r   c                    \         P                  ! 4       p\         P                  ! VR4      pV P                  V4       VP	                  R4       V P                  RV P                  V4      4       R# )zh
The L{Deferred} returned by L{task.deferLater} fires with C{None}
when no callback function is passed.
r   N)r   r(   r  assertNoResultrV   r"  r   )r   r   r  s   &  r   test_noCallbackDeferLaterTests.test_noCallback  sR    
 

OOE3'AcdD0034r   r#   N)r   r   r   r   r   r  r  r  r  r   r   r   s   @r   r  r    s#     *4(
5 
5r   r  c                   >   a  ] tR tRt o R tR tR tR tR tRt	V t
R# )	_FakeReactori  c                   R V n         \        P                  ! 4       V n        V P                  P                  V n        V P                  P
                  V n        V P                  P                  V n        . V n        R. R. /V n        R# )FbeforeduringN)	_runningr   r(   _clockr7   r*   r   _whenRunning_shutdownTriggersr>  s   &r   r   _FakeReactor.__init__  sc    jjl..{{**#{{::"*B"!=r   c                p    V P                   f   V! V/ VB  R # V P                   P                  WV34       R # r   )r  rS   )r   r  argskwargss   &&*,r   callWhenRunning_FakeReactor.callWhenRunning  s4    $d%f%$$hf%=>r   c                p    VR9   g   Q hVR8X  g   Q hV P                   V,          P                  W434       R# )r  shutdownN)r  r  )r  rS   )r   phaseeventr  r  s   &&&&*r   addSystemEventTrigger"_FakeReactor.addSystemEventTrigger  s;    ,,,,
"""u%,,h-=>r   c                   RV n         V P                  pRV n        V F  w  r#pV! V/ VB  K  	  V P                   '       dk   V P                  4       pV'       g   \        R4      hV P                  P                  V^ ,          P                  4       V P                  4       ,
          4       K|  V P                  pRV n        VR,          VR,          ,            F  w  rsV! V!   K  	  R# )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   RuntimeErrorr  rV   r;   r*   r  )r   whenRunningr  r  r  r   shutdownTriggerstriggers   &       r   run_FakeReactor.run  s     '' &1"HFd%f% '2mmm((*E"#9::KKa 0 0 2T\\^ CD11!%-h7:J8:TTTMGTN Ur   c                b    V P                   '       g   \        P                  ! 4       hRV n         R# )z
Stop the reactor.
FN)r  r   ReactorNotRunningr>  s   &r   r   _FakeReactor.stop  s#     }}}))++r   )r  r  r  r  r7   r   r*   N)r   r   r   r   r   r  r  r  r   r   r   r   s   @r   r  r    s#     >??
, r   r  c                   f   a  ] tR tRt o RtR tR tR tR tR t	R t
R	 tR
 tR tR tR tRtV tR# )
ReactTestsi  z+
Tests for L{twisted.internet.task.react}.
c                  a . oV3R lp\        4       pV P                  \        \        P                  WR7      pV P                  ^ VP                  4       V P                  SR.4       V P                  VP                  4       ^4       R# ){
L{task.react} runs the reactor until the L{Deferred} returned by the
function it is passed is called back, then stops it.
c                    < \         P                  ! 4       pV P                  ! ^SP                  R4       V P                  ! ^VP                  R4       V# ri   TNr   r  r7   rS   r  r   finished
timePasseds   & r   main4ReactTests.test_runsUntilAsyncCallback.<locals>.main$  sD    ~~'Ha!2!2D9a!2!2D9Or   _reactorTNr  r\   
SystemExitr   reactr)   coder*   r   r  r	exitErrorr  s   &   @r   test_runsUntilAsyncCallback&ReactTests.test_runsUntilAsyncCallback  so    
 
	 N%%j$**d%O	INN+dV,a(r   c                    R p\        4       pV P                  \        \        P                  WR7      pV P                  ^ VP                  4       V P                  VP                  4       ^ 4       R# )
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                 .    \         P                  ! R 4      # r   r   succeedr   s   &r   r  3ReactTests.test_runsUntilSyncCallback.<locals>.main7  s    ==&&r   r  Nr  r   r  r  r  s   &   r   test_runsUntilSyncCallback%ReactTests.test_runsUntilSyncCallback0  sU    	' N%%j$**d%O	INN+a(r   c                "  a  ! R R\         4      oV3R lp\        4       pV P                  \        \        P
                  WR7      pV P                  ^VP                  4       V P                  S4      pV P                  \        V4      ^4       R# )
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                       ] tR tRtRtR# )@ReactTests.test_runsUntilAsyncErrback.<locals>.ExpectedExceptioniF  r#   Nr$   r#   r   r   ExpectedExceptionr  F      r   r  c                 x   < \         P                  ! 4       pV P                  ! ^VP                  S! 4       4       V# ri   r   r  r7   ry  r   r  r  s   & r   r  3ReactTests.test_runsUntilAsyncErrback.<locals>.mainI  s0    ~~'Ha!1!13D3FGOr   r  N
	Exceptionr  r\   r  r   r  r)   r  flushLoggedErrorsr   r   r  r  r  errorsr  s   &    @r   test_runsUntilAsyncErrback%ReactTests.test_runsUntilAsyncErrback?  sq    		 		
 N%%j$**d%O	INN+''(9:Va(r   c                b  a  ! R R\         4      oV3R lp\        4       pV P                  \        \        P
                  WR7      pV P                  ^VP                  4       V P                  VP                  4       ^ 4       V P                  S4      pV P                  \        V4      ^4       R# )
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                       ] tR tRtRtR# )?ReactTests.test_runsUntilSyncErrback.<locals>.ExpectedExceptioni]  r#   Nr$   r#   r   r   r  r  ]  r  r   r  c                 :   < \         P                  ! S! 4       4      # r   r   failr   r  s   &r   r  2ReactTests.test_runsUntilSyncErrback.<locals>.main`  s    ::/122r   r  Nr  r  r\   r  r   r  r)   r  r*   r  r   r  s   &    @r   test_runsUntilSyncErrback$ReactTests.test_runsUntilSyncErrbackV  s    		 		3 N%%j$**d%O	INN+a(''(9:Va(r   c                    R p\        4       pV P                  \        \        P                  WR7      pV P                  VP                  4       ^4       V P                  ^ VP                  4       R# )
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                     V P                   ! ^V P                  4       \        P                  ! 4       pV P                  ! RRVP
                  R4       V# ri   r  r  Nr7   r   r   r  r  r  r   r  s   & r   r  0ReactTests.test_singleStopCallback.<locals>.mainq  sB    a.~~'H))(J@Q@QSWXOr   r  Nr  r\   r  r   r  r)   r*   r  r  s   &   r   test_singleStopCallback"ReactTests.test_singleStopCallbackj  sU    	 N%%j$**d%O	a(INN+r   c                b  a  ! R R\         4      oV3R lp\        4       pV P                  \        \        P
                  WR7      pV P                  ^VP                  4       V P                  VP                  4       ^4       V P                  S4      pV P                  \        V4      ^4       R# )
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                       ] tR tRtRtR# )<ReactTests.test_singleStopErrback.<locals>.ExpectedExceptioni  r#   Nr$   r#   r   r   r  r%    r  r   r  c                    < V P                   ! ^V P                  4       \        P                  ! 4       pV P                  ! RRVP
                  S! 4       4       V# )ri   r  r  r7   r   r   r  r  ry  r  s   & r   r  /ReactTests.test_singleStopErrback.<locals>.main  sK    a.~~'H))*h&6&68I8K Or   r  Nr  r  s   &    @r   test_singleStopErrback!ReactTests.test_singleStopErrback}  s    		 		 N%%j$**d%O	INN+a(''(9:Va(r   c                   a . oV3R lp\        4       pV P                  \        \        P                  V. ROVR7      pV P                  ^ VP                  4       V P                  S. RO4       R# )r
L{task.react} passes the elements of the list it is passed as
positional arguments to the function it is passed.
c                 V   < SP                  WV34       \        P                  ! R 4      # r   extendr   r  r   r|   yzr  s   &&&&r   r  'ReactTests.test_arguments.<locals>.main  s"    KKq	"==&&r   r  Nri   rj   r   r  r\   r  r   r  r)   r  r   r  r  r  r  s   &   @r   test_argumentsReactTests.test_arguments  sb    
 	' N%%

D)a & 
	 	INN+y)r   c                V  a  V 3R lp\        4       p\        4       ;_uu_ 4        \        V4       S P                  \        \
        P                  V. 4      pS P                  ^ VP                  4       RRR4       S P                  VS P                  4       R#   + '       g   i     L.; i)X
L{twisted.internet.reactor} is used if no reactor argument is passed to
L{task.react}.
c                 >   < V Sn         \        P                  ! R 4      # r   passedReactorr   r  r   r   s   &r   r  ,ReactTests.test_defaultReactor.<locals>.main  s    !(D==&&r   Nr  r   r   r\   r  r   r  r)   r  r"  r=  r   r  r   r  s   f   r   test_defaultReactorReactTests.test_defaultReactor  sq    	' .[[7#))*djj$KIQ	/  	gt112	 [   ABB(	c                    R p\        4       pV P                  \        \        P                  V. VR7      pV P                  ^VP                  4       R# )t
L{task.react} forwards the exit code specified by the C{SystemExit}
error returned by the passed function, if any.
c                 @    \         P                  ! \        ^4      4      # )   r   r  r  r  s   &r   r  1ReactTests.test_exitWithDefinedCode.<locals>.main  s    ::jn--r   r  Nr5  r  s   &   r   test_exitWithDefinedCode#ReactTests.test_exitWithDefinedCode  sD    	. N%%j$**dBQR%S	Y^^,r   c                    R p\        4       pV P                  \        \        P                  V. VR7      pV P                  ^ VP                  4       R# )_
L{task.react} handles when the reactor is stopped just before the
returned L{Deferred} fires.
c                 f   a a \         P                  ! 4       oVV 3R  lpS P                  ! V4       S# )c                  L   < SP                   ! 4        S P                  R 4       R # r   r   r  r  r   s   r   r   ;ReactTests.test_synchronousStop.<locals>.main.<locals>.stop      

4 r   r   r  r  r   r   r  s   f @r   r  -ReactTests.test_synchronousStop.<locals>.main  s)     A! ##D)Hr   r  Nr5  r  s   &   r   test_synchronousStopReactTests.test_synchronousStop  sD    	 N%%j$**dBQR%S	INN+r   c                    R p\        4       pV P                  \        \        P                  V. VR7      pV P                  ^ VP                  4       R# )^
L{task.react} handles when the reactor is stopped and the
returned L{Deferred} doesn't fire.
c                 f    V P                   ! ^V P                  4       \        P                  ! 4       # r  r7   r   r   r  r  s   &r   r  .ReactTests.test_asynchronousStop.<locals>.main  s#    a.>>##r   r  Nr5  r  s   &   r   test_asynchronousStop ReactTests.test_asynchronousStop  sD    	$ N%%j$**dBQR%S	INN+r   r=  Nr   r   r   r   r   r  r  r
  r  r   r)  r7  rB  rK  rX  r_  r   r   r   s   @r   r  r    F     )&)).)(,&)6*$3"-,(, ,r   r  c                   f   a  ] tR tRt o RtR tR tR tR tR t	R t
R	 tR
 tR tR tR tRtV tR# )ReactCoroutineFunctionTestsi  zH
Tests for L{twisted.internet.task.react} with an C{async def} argument
c                  a . oV3R lp\        4       pV P                  \        \        P                  WR7      pV P                  ^ VP                  4       V P                  SR.4       V P                  VP                  4       ^4       R# )r  c                    <"   \         P                  ! 4       pV P                  ! ^SP                  R4       V P                  ! ^VP                  R4       VG Rj  xL
 #  L5ir  r  r  s   & r   r  EReactCoroutineFunctionTests.test_runsUntilAsyncCallback.<locals>.main  sL     ~~'Ha!2!2D9a!2!2D9!>!>s   AA!AA!r  TNr  r  s   &   @r   r  7ReactCoroutineFunctionTests.test_runsUntilAsyncCallback  so    
 
	" N%%j$**d%O	INN+dV,a(r   c                    R p\        4       pV P                  \        \        P                  WR7      pV P                  ^ VP                  4       V P                  VP                  4       ^ 4       R# )r  c                 J   "   \         P                  ! R 4      G R j  xL
 #  L5ir   r  r  s   &r   r  DReactCoroutineFunctionTests.test_runsUntilSyncCallback.<locals>.main
  s     t,,,,s   #!#r  Nr  r  s   &   r   r  6ReactCoroutineFunctionTests.test_runsUntilSyncCallback  sU    	- N%%j$**d%O	INN+a(r   c                "  a  ! R R\         4      oV3R lp\        4       pV P                  \        \        P
                  WR7      pV P                  ^VP                  4       V P                  S4      pV P                  \        V4      ^4       R# )r  c                       ] tR tRtRtR# )QReactCoroutineFunctionTests.test_runsUntilAsyncErrback.<locals>.ExpectedExceptioni  r#   Nr$   r#   r   r   r  rp    r  r   r  c                    <"   \         P                  ! 4       pV P                  ! ^VP                  S! 4       4       VG Rj  xL
 #  L5ir  r  r  s   & r   r  DReactCoroutineFunctionTests.test_runsUntilAsyncErrback.<locals>.main  s8     ~~'Ha!1!13D3FG!>!>s   >AAAr  Nr  r  s   &    @r   r
  6ReactCoroutineFunctionTests.test_runsUntilAsyncErrback  sq    		 		"
 N%%j$**d%O	INN+''(9:Va(r   c                b  a  ! R R\         4      oV3R lp\        4       pV P                  \        \        P
                  WR7      pV P                  ^VP                  4       V P                  VP                  4       ^ 4       V P                  S4      pV P                  \        V4      ^4       R# )r  c                       ] tR tRtRtR# )PReactCoroutineFunctionTests.test_runsUntilSyncErrback.<locals>.ExpectedExceptioni0  r#   Nr$   r#   r   r   r  rv  0  r  r   r  c                 V   <"   \         P                  ! S! 4       4      G R j  xL
 #  L5ir   r  r  s   &r   r  CReactCoroutineFunctionTests.test_runsUntilSyncErrback.<locals>.main3  s     $5$78888s   )')r  Nr  r  s   &    @r   r  5ReactCoroutineFunctionTests.test_runsUntilSyncErrback)  s    		 		9 N%%j$**d%O	INN+a(''(9:Va(r   c                    R p\        4       pV P                  \        \        P                  WR7      pV P                  VP                  4       ^4       V P                  ^ VP                  4       R# )r  c                    "   V P                   ! ^V P                  4       \        P                  ! 4       pV P                  ! RRVP
                  R4       VG Rj  xL
 #  L5ir  r  r  s   & r   r  AReactCoroutineFunctionTests.test_singleStopCallback.<locals>.mainD  sJ     a.~~'H))(J@Q@QSWX!>!>s   AA AA r  Nr  r  s   &   r   r   3ReactCoroutineFunctionTests.test_singleStopCallback=  sU    	" N%%j$**d%O	a(INN+r   c                b  a  ! R R\         4      oV3R lp\        4       pV P                  \        \        P
                  WR7      pV P                  ^VP                  4       V P                  VP                  4       ^4       V P                  S4      pV P                  \        V4      ^4       R# )r#  c                       ] tR tRtRtR# )MReactCoroutineFunctionTests.test_singleStopErrback.<locals>.ExpectedExceptioniW  r#   Nr$   r#   r   r   r  r  W  r  r   r  c                    <"   V P                   ! ^V P                  4       \        P                  ! 4       pV P                  ! RRVP
                  S! 4       4       VG Rj  xL
 #  L5ir  r'  r  s   & r   r  @ReactCoroutineFunctionTests.test_singleStopErrback.<locals>.mainZ  sS     a.~~'H))*h&6&68I8K ">!>s   AA&A$ A&r  Nr  r  s   &    @r   r)  2ReactCoroutineFunctionTests.test_singleStopErrbackP  s    		 		" N%%j$**d%O	INN+a(''(9:Va(r   c                   a . oV3R lp\        4       pV P                  \        \        P                  V. ROVR7      pV P                  ^ VP                  4       V P                  S. RO4       R# )r,  c                 r   <"   SP                  WV34       \        P                  ! R 4      G R j  xL
 #  L5ir   r.  r0  s   &&&&r   r  8ReactCoroutineFunctionTests.test_arguments.<locals>.mainr  s+     KKq	"t,,,,s   -757r  Nr4  r5  r6  s   &   @r   r7  *ReactCoroutineFunctionTests.test_argumentsk  sb    
 	- N%%

D)a & 
	 	INN+y)r   c                V  a  V 3R lp\        4       p\        4       ;_uu_ 4        \        V4       S P                  \        \
        P                  V. 4      pS P                  ^ VP                  4       RRR4       S P                  VS P                  4       R#   + '       g   i     L.; i)r:  c                 Z   <"   V Sn         \        P                  ! R 4      G R j  xL
 #  L5ir   r<  r>  s   &r   r  =ReactCoroutineFunctionTests.test_defaultReactor.<locals>.main  s#     !(Dt,,,,s   !+)+Nr@  rA  s   f   r   rB  /ReactCoroutineFunctionTests.test_defaultReactor}  sq    	- .[[7#))*djj$KIQ	/  	gt112	 [rD  c                    R p\        4       pV P                  \        \        P                  V. VR7      pV P                  ^VP                  4       R# )rF  c                 \   "   \         P                  ! \        ^4      4      G Rj  xL
 #  L5i)rH  NrI  r  s   &r   r  BReactCoroutineFunctionTests.test_exitWithDefinedCode.<locals>.main  s     JrN3333s   #,*,r  Nr5  r  s   &   r   rK  4ReactCoroutineFunctionTests.test_exitWithDefinedCode  sD    	4 N%%j$**dBQR%S	Y^^,r   c                    R p\        4       pV P                  \        \        P                  V. VR7      pV P                  ^ VP                  4       R# )rN  c                    a a"   \         P                  ! 4       oVV 3R  lpS P                  ! V4       SG Rj  xL
 #  L5i)c                  L   < SP                   ! 4        S P                  R 4       R # r   rQ  rR  s   r   r   LReactCoroutineFunctionTests.test_synchronousStop.<locals>.main.<locals>.stop  rT  r   NrU  rV  s   f @r   r  >ReactCoroutineFunctionTests.test_synchronousStop.<locals>.main  s0      A! ##D)7N7s   4?=?r  Nr5  r  s   &   r   rX  0ReactCoroutineFunctionTests.test_synchronousStop  sD    	 N%%j$**dBQR%S	INN+r   c                    R p\        4       pV P                  \        \        P                  V. VR7      pV P                  ^ VP                  4       R# )r[  c                    "   V P                   ! ^V P                  4       \        P                  ! 4       G Rj  xL
 #  L5ir  r]  r  s   &r   r  ?ReactCoroutineFunctionTests.test_asynchronousStop.<locals>.main  s,     a.))))s   6?=?r  Nr5  r  s   &   r   r_  1ReactCoroutineFunctionTests.test_asynchronousStop  sD    	* N%%j$**dBQR%S	INN+r   ra  Nrb  r   s   @r   re  re    rc  r   re  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  re  r#   r   r   <module>r     s   
 E D 0 9 " 	

 "$** 	I 	O+"" O+d^:!! ^:BG1x(( G1TF5h'' F5R1 1hP,-- P,fP,(">"> P,r   