%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/twisted/internet/test/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/twisted/internet/test/__pycache__/test_cfreactor.cpython-312.pyc

�

Ϫ�f`���ddlmZmZddlmZddlmZereZneZd	d�Z	e	�Gd�dee�Z
e�je
j��y)
�)�
TYPE_CHECKING�List)�SynchronousTestCase�)�ReactorBuilderNc��y)z0
    Do-nothing callable. Stub for testing.
    N�r	��F/usr/lib/python3/dist-packages/twisted/internet/test/test_cfreactor.py�nooprs�r
c�6�eZdZdZdgZdd�Zdd�Zdd�Zdd�Zy)	�CoreFoundationSpecificTestszN
    Tests for platform interactions of the CoreFoundation-based reactor.
    z$twisted.internet.cfreactor.CFReactorNc���|j�}|jd|j�|jdt�|j	|�|j|jd�y)zO
        CFReactor's simulation timer is None after CFReactor crashes.
        r�dN)�buildReactor�	callLater�crashr�
runReactor�assertIs�_currentSimulator)�self�rs  r�test_whiteboxStopSimulatingz7CoreFoundationSpecificTests.test_whiteboxStopSimulatingsR��
�����	���A�q�w�w��	���C���������
�
�a�)�)�4�0r
c����|j�}|jdt�}|j��d��fd�}d�fd���jd|�|j��|j	|j�|g�y)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.
        rNc�*���jd��y)Nr)r)�r2�r2stops��r�stopBlockingzGCoreFoundationSpecificTests.test_callLaterLeakage.<locals>.stopBlocking3s����L�L��F�#r
c�&���j�y�N)�stop)rs�rrzACoreFoundationSpecificTests.test_callLaterLeakage.<locals>.r2stop6s����G�G�Ir
��returnN)rrrr�assertEqual�getDelayedCalls)rr�delayedrrrs    @@r�test_callLaterLeakagez1CoreFoundationSpecificTests.test_callLaterLeakage&sr���
������+�+�a��&��
�
�
�
 ��	$�	�	���Q��%����������*�*�,�w�i�8r
c�N�|j�}g}|jd|jd�|jdt�}|j	�|j|jd�|j|j�|g�|j|dg�y)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.
        rrrN)	rr�appendr�iteraterrr$r%)rr�xr&s    r�test_whiteboxIteratez0CoreFoundationSpecificTests.test_whiteboxIterate=s���
�������	���A�q�x�x��#��+�+�c�4�(��	�	�	���
�
�a�)�)�4�0�����*�*�,�w�i�8�����Q�C� r
c������|j��g�d��fd��d��fd�}�jd�j|��j�|j	�dg�y)zS
        The loop can wake up just fine even if there are no timers in it.
        Nc�H���j��jd�y)N�yes)r!r))r�stoppeds��r�doStopz9CoreFoundationSpecificTests.test_noTimers.<locals>.doStopUs���
�F�F�H��N�N�5�!r
c�(���j��yr )�callFromThread)r1rs��r�
sleepThenStopz@CoreFoundationSpecificTests.test_noTimers.<locals>.sleepThenStopYs���
���V�$r
rr/r")rr�callInThread�runr$)rr4r1rr0s  @@@r�
test_noTimersz)CoreFoundationSpecificTests.test_noTimersNsU���
�������	"�	%�	
���A�q�~�~�}�5�
	
��������5�'�*r
r")	�__name__�
__module__�__qualname__�__doc__�	_reactorsrr'r,r7r	r
rrrs%���8�8�I�1�9�.!�"+r
rr")�typingrr�twisted.trial.unittestr�
reactormixinsr�fakeBase�objectrr�globals�update�makeTestCaseClassesr	r
r�<module>rEsT��&�6�)��"�H��H����M+�.�(�M+�`�	���,�@�@�B�Cr

Zerion Mini Shell 1.0