+
    Dfj`                         ^ RI HtHt ^ RIHt ^RIHt ]'       d   ]tM]tR R lt	]	! 4         ! R R]]4      t
]! 4       P                  ]
P                  4       4       R# )	    )TYPE_CHECKINGList)SynchronousTestCase)ReactorBuilderc                    V ^8  d   QhRR/#    returnN )formats   "F/usr/lib/python3/dist-packages/twisted/internet/test/test_cfreactor.py__annotate__r      s      d     c                     R# )z(
Do-nothing callable. Stub for testing.
Nr   r   r   r   noopr      s    r   c                   r   a  ] tR t^t o RtR.tV 3R lR ltV 3R lR ltV 3R lR ltV 3R	 lR
 lt	Rt
V tR# )CoreFoundationSpecificTestszF
Tests for platform interactions of the CoreFoundation-based reactor.
z$twisted.internet.cfreactor.CFReactorc                   < V ^8  d   QhRR/# r   r   )r   __classdict__s   "r   r   (CoreFoundationSpecificTests.__annotate__   s     1 1T 1r   c                    V P                  4       pVP                  ^ VP                  4       VP                  ^d\        4       V P	                  V4       V P                  VP                  R4       R# )z?
CFReactor's simulation timer is None after CFReactor crashes.
N)buildReactor	callLatercrashr   
runReactorassertIs_currentSimulator)selfrs   & r   test_whiteboxStopSimulating7CoreFoundationSpecificTests.test_whiteboxStopSimulating   sR     	Aqww	Ca))40r   c                   < V ^8  d   QhRR/# r   r   )r   r   s   "r   r   r   &   s     9 9t 9r   c                $  aa V P                  4       pVP                  ^ \        4      pV P                  4       oR VV3R llpR V3R lloSP                  ^ V4       V P                  S4       V P	                  VP                  4       V.4       R# )a,  
callLater should not leak global state into CoreFoundation which will
be invoked by a different reactor running the main loop.

@note: this test may actually be usable for other reactors as well, so
    we may wish to promote it to ensure this invariant across other
    foreign-main-loop reactors.
c                    V ^8  d   QhRR/# r   r   )r   s   "r   r   GCoreFoundationSpecificTests.test_callLaterLeakage.<locals>.__annotate__3   s     	$ 	$d 	$r   c                  ,   < S P                  ^ S4       R# )r   N)r   )r2r2stops   r   stopBlockingGCoreFoundationSpecificTests.test_callLaterLeakage.<locals>.stopBlocking3   s    LLF#r   c                    V ^8  d   QhRR/# r   r   )r   s   "r   r   r%   6   s     	 	 	r   c                  (   < S P                  4        R # N)stop)r'   s   r   r(   ACoreFoundationSpecificTests.test_callLaterLeakage.<locals>.r2stop6   s    GGIr   N)r   r   r   r   assertEqualgetDelayedCalls)r   r   delayedr)   r'   r(   s   &   @@r   test_callLaterLeakage1CoreFoundationSpecificTests.test_callLaterLeakage&   s|     ++a& 	$ 	$	 	 	Q%**,wi8r   c                   < V ^8  d   QhRR/# r   r   )r   r   s   "r   r   r   =   s     ! !d !r   c                P   V P                  4       p. pVP                  ^ VP                  ^4       VP                  ^d\        4      pVP	                  4        V P                  VP                  R4       V P                  VP                  4       V.4       V P                  V^.4       R# )a>  
C{.iterate()} should remove the CFTimer that will run Twisted's
callLaters from the loop, even if one is still pending.  We test this
state indirectly with a white-box assertion by verifying the
C{_currentSimulator} is set to C{None}, since CoreFoundation does not
allow us to enumerate all active timers or sources.
N)	r   r   appendr   iterater   r   r0   r1   )r   r   xr2   s   &   r   test_whiteboxIterate0CoreFoundationSpecificTests.test_whiteboxIterate=   s     	Aqxx#++c4(			a))40**,wi8QC r   c                   < V ^8  d   QhRR/# r   r   )r   r   s   "r   r   r   N   s     + +t +r   c                   aaa V P                  4       o. oR VV3R lloR VV3R llpSP                  ^ SP                  V4       SP                  4        V P	                  SR.4       R# )zC
The loop can wake up just fine even if there are no timers in it.
c                    V ^8  d   QhRR/# r   r   )r   s   "r   r   ?CoreFoundationSpecificTests.test_noTimers.<locals>.__annotate__U   s     	" 	" 	"r   c                  J   < S P                  4        SP                  R 4       R# )yesN)r.   r7   )r   stoppeds   r   doStop9CoreFoundationSpecificTests.test_noTimers.<locals>.doStopU   s    FFHNN5!r   c                    V ^8  d   QhRR/# r   r   )r   s   "r   r   r?   Y   s     	% 	%t 	%r   c                  *   < SP                  S 4       R # r-   )callFromThread)rC   r   s   r   sleepThenStop@CoreFoundationSpecificTests.test_noTimers.<locals>.sleepThenStopY   s    V$r   rA   N)r   r   callInThreadrunr0   )r   rH   rC   r   rB   s   & @@@r   test_noTimers)CoreFoundationSpecificTests.test_noTimersN   s_     	" 	"	% 	% 	
Aq~~}5
 	
5'*r   r   N)__name__
__module____qualname____firstlineno____doc__	_reactorsr    r3   r:   rL   __static_attributes____classdictcell__)r   s   @r   r   r      s<      88I1 19 9.! !"+ +r   r   N)typingr   r   twisted.trial.unittestr   reactormixinsr   fakeBaseobjectr   r   globalsupdatemakeTestCaseClassesr   r   r   <module>r^      sT    & 6 )"HH M+.( M+` 	  ,@@B Cr   