ó
    Ö›‘h`  ã                   ó¼   • S SK JrJr  S SKJr  SSKJr  \(       a  \rO\rS	S jr	\	" 5          " S S\\5      r
\" 5       R                  \
R                  5       5        g)
é    )ÚTYPE_CHECKINGÚList)ÚSynchronousTestCaseé   )ÚReactorBuilderNc                  ó   • g)z(
Do-nothing callable. Stub for testing.
N© r	   ó    ÚhC:\Users\psant\Downloads\Noiseback\school\venv\Lib\site-packages\twisted/internet/test/test_cfreactor.pyÚnoopr      s   � r
   c                   óF   • \ rS rSrSrS/rS
S jrS
S jrS
S jrS
S jr	S	r
g)ÚCoreFoundationSpecificTestsé   zF
Tests for platform interactions of the CoreFoundation-based reactor.
z$twisted.internet.cfreactor.CFReactorNc                 óâ   • U R                  5       nUR                  SUR                  5        UR                  S[        5        U R	                  U5        U R                  UR                  S5        g)z?
CFReactor's simulation timer is None after CFReactor crashes.
r   éd   N)ÚbuildReactorÚ	callLaterÚcrashr   Ú
runReactorÚassertIsÚ_currentSimulator)ÚselfÚrs     r   Útest_whiteboxStopSimulatingÚ7CoreFoundationSpecificTests.test_whiteboxStopSimulating   sR   € ð ×ÑÓˆØ	�‰�A�q—w‘wÔØ	�‰�CœÔØ�‰˜ÔØ�‰�a×)Ñ)¨4Õ0r
   c                 ó  ^^• U R                  5       nUR                  S[        5      nU R                  5       mSUU4S jjnSU4S jjmTR                  SU5        U R                  T5        U R	                  UR                  5       U/5        g)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.
r   Nc                  ó*   >• T R                  ST5        g )Nr   )r   )Úr2Úr2stops   €€r   ÚstopBlockingÚGCoreFoundationSpecificTests.test_callLaterLeakage.<locals>.stopBlocking3   s   ø€ Ø�L‰L˜˜FÕ#r
   c                  ó&   >• T R                  5         g ©N)Ústop)r   s   €r   r   ÚACoreFoundationSpecificTests.test_callLaterLeakage.<locals>.r2stop6   s   ø€ Ø�G‰G�Ir
   ©ÚreturnN)r   r   r   r   ÚassertEqualÚgetDelayedCalls)r   r   Údelayedr    r   r   s       @@r   Útest_callLaterLeakageÚ1CoreFoundationSpecificTests.test_callLaterLeakage&   sw   ù€ ð ×ÑÓˆØ—+‘+˜a¤Ó&ˆØ×ÑÓ ˆ÷	$ð 	$÷	ð 	�‰�Q˜Ô%Ø�‰˜ÔØ×Ñ˜×*Ñ*Ó,¨w¨iÕ8r
   c                 óN  • U R                  5       n/ nUR                  SUR                  S5        UR                  S[        5      nUR	                  5         U R                  UR                  S5        U R                  UR                  5       U/5        U R                  US/5        g)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.
r   r   r   N)	r   r   Úappendr   Úiterater   r   r(   r)   )r   r   Úxr*   s       r   Útest_whiteboxIterateÚ0CoreFoundationSpecificTests.test_whiteboxIterate=   s…   € ð ×ÑÓˆØˆØ	�‰�A�q—x‘x Ô#Ø—+‘+˜c¤4Ó(ˆØ	�	‰	ŒØ�‰�a×)Ñ)¨4Ô0Ø×Ñ˜×*Ñ*Ó,¨w¨iÔ8Ø×Ñ˜˜Q˜CÕ r
   c                 óÒ   ^^^• U R                  5       m/ mSUU4S jjmSUU4S jjnTR                  STR                  U5        TR                  5         U R	                  TS/5        g)zC
The loop can wake up just fine even if there are no timers in it.
Nc                  óH   >• T R                  5         TR                  S5        g )NÚyes)r$   r.   )r   Ústoppeds   €€r   ÚdoStopÚ9CoreFoundationSpecificTests.test_noTimers.<locals>.doStopU   s   ø€ Ø�F‰FŒHØ�N‰N˜5Õ!r
   c                  ó(   >• TR                  T 5        g r#   )ÚcallFromThread)r7   r   s   €€r   ÚsleepThenStopÚ@CoreFoundationSpecificTests.test_noTimers.<locals>.sleepThenStopY   s   ø€ Ø×Ñ˜VÕ$r
   r   r5   r&   )r   r   ÚcallInThreadÚrunr(   )r   r;   r7   r   r6   s     @@@r   Útest_noTimersÚ)CoreFoundationSpecificTests.test_noTimersN   s_   ú€ ð ×ÑÓˆØˆ÷	"ð 	"÷	%ð 	%ð 	
�‰�A�q—~‘~ }Ô5ð
 	
�‰ŒØ×Ñ˜ 5 'Õ*r
   r	   r&   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú	_reactorsr   r+   r1   r?   Ú__static_attributes__r	   r
   r   r   r      s%   † ñð 8Ð8€Iô1ô9ô.!÷"+r
   r   r&   )Útypingr   r   Útwisted.trial.unittestr   Úreactormixinsr   ÚfakeBaseÚobjectr   r   ÚglobalsÚupdateÚmakeTestCaseClassesr	   r
   r   Ú<module>rP      sT   ðß &å 6Ý )æØ"�Hà€Hôñ „ôM+ .°(ô M+ñ` ƒ	× Ñ Ð,×@Ñ@ÓBÕ Cr
   