§
    Ètºf`  ã                   óÔ   — d dl mZmZ d dlmZ ddlmZ ereZneZd
d„Z	 e	¦   «           G d„ d	ee¦  «        Z
 e¦   «                              e
                     ¦   «         ¦  «         dS )é    )ÚTYPE_CHECKINGÚList)ÚSynchronousTestCaseé   )ÚReactorBuilderÚreturnNc                  ó   — dS )z0
    Do-nothing callable. Stub for testing.
    N© r
   ó    úc/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/twisted/internet/test/test_cfreactor.pyÚnoopr      s   € € € r   c                   ó8   — e Zd ZdZdgZd	d„Zd	d„Zd	d„Zd	d„ZdS )
ÚCoreFoundationSpecificTestszN
    Tests for platform interactions of the CoreFoundation-based reactor.
    z$twisted.internet.cfreactor.CFReactorr   Nc                 óú   — |                       ¦   «         }|                     d|j        ¦  «         |                     dt          ¦  «         |                      |¦  «         |                      |j        d¦  «         dS )zO
        CFReactor's simulation timer is None after CFReactor crashes.
        r   éd   N)ÚbuildReactorÚ	callLaterÚcrashr   Ú
runReactorÚassertIsÚ_currentSimulator)ÚselfÚrs     r   Útest_whiteboxStopSimulatingz7CoreFoundationSpecificTests.test_whiteboxStopSimulating   sn   € ð ×ÒÑÔˆØ	�Š�A�q”wÑÔÐØ	�Š�C�ÑÔÐØ�Š˜ÑÔÐØ�Š�aÔ)¨4Ñ0Ô0Ð0Ð0Ð0r   c                 óR  ‡‡— |                       ¦   «         }|                     dt          ¦  «        }|                       ¦   «         Šdˆˆfd„}dˆfd„Š‰                     d|¦  «         |                      ‰¦  «         |                      |                     ¦   «         |g¦  «         dS )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   r   Nc                  ó4   •— ‰                       d‰¦  «         d S )Nr   )r   )Úr2Úr2stops   €€r   ÚstopBlockingzGCoreFoundationSpecificTests.test_callLaterLeakage.<locals>.stopBlocking3   s   ø€ Ø�LŠL˜˜FÑ#Ô#Ð#Ð#Ð#r   c                  ó0   •— ‰                       ¦   «          d S ©N)Ústop)r   s   €r   r   zACoreFoundationSpecificTests.test_callLaterLeakage.<locals>.r2stop6   s   ø€ Ø�GŠG‰IŒIˆIˆIˆIr   ©r   N)r   r   r   r   ÚassertEqualÚgetDelayedCalls)r   r   Údelayedr   r   r   s       @@r   Útest_callLaterLeakagez1CoreFoundationSpecificTests.test_callLaterLeakage&   sÎ   øø€ ð ×ÒÑÔˆØ—+’+˜a¥Ñ&Ô&ˆØ×ÒÑ Ô ˆð	$ð 	$ð 	$ð 	$ð 	$ð 	$ð 	$ð	ð 	ð 	ð 	ð 	ð 	ð 	�Š�Q˜Ñ%Ô%Ð%Ø�Š˜ÑÔÐØ×Ò˜×*Ò*Ñ,Ô,¨w¨iÑ8Ô8Ð8Ð8Ð8r   c                 ó~  — |                       ¦   «         }g }|                     d|j        d¦  «         |                     dt          ¦  «        }|                     ¦   «          |                      |j        d¦  «         |                      |                     ¦   «         |g¦  «         |                      |dg¦  «         dS )an  
        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_whiteboxIteratez0CoreFoundationSpecificTests.test_whiteboxIterate=   s«   € ð ×ÒÑÔˆØˆØ	�Š�A�q”x Ñ#Ô#Ð#Ø—+’+˜c¥4Ñ(Ô(ˆØ	�	Š	‰ŒˆØ�Š�aÔ)¨4Ñ0Ô0Ð0Ø×Ò˜×*Ò*Ñ,Ô,¨w¨iÑ8Ô8Ð8Ø×Ò˜˜Q˜CÑ Ô Ð Ð Ð r   c                 óâ   ‡‡‡— |                       ¦   «         Šg Šdˆˆfd„Šdˆˆfd„}‰                     d‰j        |¦  «         ‰                     ¦   «          |                      ‰dg¦  «         dS )zS
        The loop can wake up just fine even if there are no timers in it.
        r   Nc                  óZ   •— ‰                       ¦   «          ‰                     d¦  «         d S )NÚyes)r"   r)   )r   Ústoppeds   €€r   ÚdoStopz9CoreFoundationSpecificTests.test_noTimers.<locals>.doStopU   s(   ø€ Ø�FŠF‰HŒHˆHØ�NŠN˜5Ñ!Ô!Ð!Ð!Ð!r   c                  ó2   •— ‰                      ‰ ¦  «         d S r!   )ÚcallFromThread)r1   r   s   €€r   ÚsleepThenStopz@CoreFoundationSpecificTests.test_noTimers.<locals>.sleepThenStopY   s   ø€ Ø×Ò˜VÑ$Ô$Ð$Ð$Ð$r   r   r/   r#   )r   r   ÚcallInThreadÚrunr$   )r   r4   r1   r   r0   s     @@@r   Útest_noTimersz)CoreFoundationSpecificTests.test_noTimersN   sª   øøø€ ð ×ÒÑÔˆØˆð	"ð 	"ð 	"ð 	"ð 	"ð 	"ð 	"ð	%ð 	%ð 	%ð 	%ð 	%ð 	%ð 	%ð 	
�Š�A�q”~ }Ñ5Ô5Ð5ð
 	
�Š‰ŒˆØ×Ò˜ 5 'Ñ*Ô*Ð*Ð*Ð*r   r#   )	Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	_reactorsr   r'   r,   r7   r
   r   r   r   r      sx   € € € € € ðð ð 8Ð8€Ið1ð 1ð 1ð 1ð9ð 9ð 9ð 9ð.!ð !ð !ð !ð"+ð +ð +ð +ð +ð +r   r   r#   )Útypingr   r   Útwisted.trial.unittestr   Úreactormixinsr   ÚfakeBaseÚobjectr   r   ÚglobalsÚupdateÚmakeTestCaseClassesr
   r   r   ú<module>rE      sÚ   ðØ &Ð &Ð &Ð &Ð &Ð &Ð &Ð &à 6Ð 6Ð 6Ð 6Ð 6Ð 6Ø )Ð )Ð )Ð )Ð )Ð )àð Ø"€H€Hà€Hðð ð ð ð €�„€ðM+ð M+ð M+ð M+ð M+ .°(ñ M+ô M+ð M+ð` €�	„	× Ò Ð,×@Ò@ÑBÔBÑ CÔ CÐ CÐ CÐ Cr   