Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.12/test/test_asyncio/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.12/test/test_asyncio/__pycache__/test_waitfor.cpython-312.opt-2.pyc

�

(ΜgD*����ddlZddlZddlZddlmZd�ZdZGd�d�ZGd�dej�Z	Gd	�d
ej�Z
edk(rej�yy)�N)�supportc�.�tjd�y�N)�asyncio�set_event_loop_policy���;/usr/local/lib/python3.12/test/test_asyncio/test_waitfor.py�tearDownModulers���!�!�$�'r	g-C��6?c��eZdZ	dZd�Zd�Zy)�SlowTask皙�����?c��d|_y)NF)�exited��selfs r
�__init__zSlowTask.__init__s	����r	c��K�tj�|jz}	|tj�z
}|dkr		d|_y	tj|��d{����D7�#tj
$rY�wxYw�w)NTr)�time�	monotonic�TASK_TIMEOUTr�sleep�CancelledErrorr)r�exitat�tosleeps   r
�runzSlowTask.runs|�������!�D�$5�$5�5����t�~�~�/�/�G��!�|�����
��m�m�G�,�,�,�
�-���)�)�
��
�s<�AB�A+�#A)�$A+�(B�)A+�+B�>B�B�BN)�__name__�
__module__�__qualname__rrrrr	r
r
r
s��I��L��
r	r
c�r�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zy)�AsyncioWaitForTestc��|K�t�}tjtj|j	�|j
dz��}tjd��d{���|j�tj|h��d{���|j|j�y7�N7�"�w)N�r)r
r�create_task�wait_forrrr�cancel�wait�
assertTruer)r�t�waitfortasks   r
�test_asyncio_wait_for_cancelledz2AsyncioWaitForTest.test_asyncio_wait_for_cancelled*s������J���)�)����Q�U�U�W�a�n�n�q�&8�9�;���m�m�A���������l�l�K�=�)�)�)�������!�		��)�s$�A'B<�)B8�*-B<�B:�!B<�:B<c��K�t�}	tj|j�|jdz��d{���|j
|j�y7� #tj
$rY�3wxYw�w)Nr#)r
rr%rr�TimeoutErrorr(r)rr)s  r
�test_asyncio_wait_for_timeoutz0AsyncioWaitForTest.test_asyncio_wait_for_timeout5sf�����J��	��"�"�1�5�5�7�A�N�N�Q�,>�?�?�?�	
������!�	
@���#�#�	��	�s:�A>�4A%�A#�A%�A>�#A%�%A;�8A>�:A;�;A>c��K�tj�}|j�}|jd�tj|d��d{���}|j|d�|j
|j��y7�6�w)N�doner)r�get_running_loop�
create_future�
set_resultr%�assertEqualr(r0)r�loop�fut�rets    r
�2test_wait_for_timeout_less_then_0_or_0_future_donezEAsyncioWaitForTest.test_wait_for_timeout_less_then_0_or_0_future_done?sj�����'�'�)��� � �"�����v���$�$�S�!�,�,������f�%�������
�#�-�s�AB
�B�7B
c����K�d��fd�}|jtj�5tj|�d��d{���ddd�|j	�d�y7�#1swY�xYw�w)NFc���K�d�y�w)NTr)�foo_starteds�r
�fooz_AsyncioWaitForTest.test_wait_for_timeout_less_then_0_or_0_coroutine_do_not_started.<locals>.fooMs������K�s�r)�assertRaisesrr-r%r4)rr<r;s  @r
�?test_wait_for_timeout_less_then_0_or_0_coroutine_do_not_startedzRAsyncioWaitForTest.test_wait_for_timeout_less_then_0_or_0_coroutine_do_not_startedJsd�������	��
�
�w�3�3�
4��"�"�3�5�!�,�,�,�5�	
����e�,�
-��5�
4�s.�'A7�A+�	A)�
A+�A7�)A+�+A4�0A7c��Z��K�tj�}dD]�}|j|��5d�|j����fd�}tj|��}��d{���|jtj�5tj||��d{���ddd�|j|j��|j|j��|j�d�ddd���y7��7�i#1swY�hxYw#1swY��
xYw�w)N)r�����timeoutc���K�d��jd�	tjd��d{���d�y7�#d�wxYw�w)NT�
Fr0)r3rr)�foo_running�starteds��r
r<zFAsyncioWaitForTest.test_wait_for_timeout_less_then_0_or_0.<locals>.foo^sD�����"&�K��&�&�t�,�,�%�m�m�B�/�/�/�&+��!�0��&+��s#�A�:�8�:�A�:�>�AF)rr1�subTestr2r$r=r-r%r(r0�	cancelledr4)rr5rBr<r6rErFs     @@r
�&test_wait_for_timeout_less_then_0_or_0z9AsyncioWaitForTest.test_wait_for_timeout_less_then_0_or_0Vs�������'�'�)���G����g��.�"���,�,�.��"��)�)�#�%�0���
�
��&�&�w�';�';�<�!�*�*�3��8�8�8�=�������
�+�����
�
��0�� � ��e�4�//�.�� ��9��=�<��#/�.�sY�,D+�8D�(D�)#D�D�&D
�'D�+AD�D+�D�D�D�D�D(	�#D+c���K�d��fd�}tj|��}|jtj�5tj|d��d{���ddd�|j|j
��|j|j��|j�d�y7�]#1swY�\xYw�w)Nc���K�d�	tjtj��d{���d�y7�#d�wxYw�w)NTFr0)rrr�LONG_TIMEOUT)rEs�r
r<z-AsyncioWaitForTest.test_wait_for.<locals>.foovs<������K�
$��m�m�G�$8�$8�9�9�9�#���:��#��s �>�&7�5�7�>�7�;�>皙�����?F)	rr$r=r-r%r(r0rHr4)rr<r6rEs   @r
�
test_wait_forz AsyncioWaitForTest.test_wait_forss��������	��!�!�#�%�(��
�
�
�w�3�3�
4��"�"�3��,�,�,�5�������
�#�����
�
��(�����e�,�	
-��5�
4�s1�AC
�B>�B<�B>�#AC
�<B>�>C�C
c��K�d�}tj|�d���d{���}|j|d�y7��w)Nc��K�y�w�Nr0rrr	r
�coroz7AsyncioWaitForTest.test_wait_for_blocking.<locals>.coro��	�������rAr0�rr%r4)rrR�ress   r
�test_wait_for_blockingz)AsyncioWaitForTest.test_wait_for_blocking�s9����	��$�$�T�V�T�:�:������f�%�;���#?�=�?c��K�tj�}|j�}tj|d��}|j	|j
d�|�d{���}|j
|d�y7��w)NrrA�ok)rr1r2r%�	call_soonr3r4)rr5r6�taskrVs     r
�test_wait_for_race_conditionz/AsyncioWaitForTest.test_wait_for_race_condition�sb�����'�'�)��� � �"������S�1�����s�~�~�t�,��j������d�#��s�AA9�A7� A9c���K��fd�}tj|�d���d{���}�j|d�y7��w)Nc���K��jtj�5tjd��d{���ddd�y7�
#1swYyxYw�w)N�)r=rrrrs�r
�innerzKAsyncioWaitForTest.test_wait_for_cancellation_race_condition.<locals>.inner�sC������"�"�7�#9�#9�:��m�m�A�&�&�&�;��'��;��s,� A�A�A
�A�	A�
A�A�A�{�G�z�?rAr`rU)rra�results`  r
�)test_wait_for_cancellation_race_conditionz<AsyncioWaitForTest.test_wait_for_cancellation_race_condition�s:�����	�
�'�'����=�=�������#�>�s�%A�A�Ac���K�d��fd�}tj|��}|jtj�5}tj|t
���d{���ddd�|j
��jj}|jt|�tj�y7�]#1swY�\xYw�w)NFc����K�	tjd��d{���d�y7�#tj$r$tjt��d{���7�wxYw#d�wxYw�w�NrDT�rrr�_EPSILON��	task_dones�r
razKAsyncioWaitForTest.test_wait_for_waits_for_task_cancellation.<locals>.inner�s[�����
!��m�m�B�'�'�'�
!�	�(���)�)�
��m�m�H�-�-�-��
��!�	��=�A(�'�%�'�A(�'�/A�A�A�A!�!A%�%A(rA)rr$r=r-r%rir(�	exception�__context__r4�typer)rra�
inner_task�cm�chainedrks     @r
�)test_wait_for_waits_for_task_cancellationz<AsyncioWaitForTest.test_wait_for_waits_for_task_cancellation�s�������	�	!��(�(���1�
�
�
�
�w�3�3�
4���"�"�:�x�@�@�@�5�	
���	�"��,�,�*�*������g���(>�(>�?�	
A��5�
4�s1�AC�C�#C�$C�(AC�C�C�Cc��F�K�d��fd�}|jtj�5}|��d{���ddd�|j��jj
}|j
t|�tj�y7�]#1swY�\xYw�w)NFc����K��fd�}tj|��}tjt��d{���tj|d���d{���y7�$7��w)Nc����K�	tjd��d{���d�y7�#tj$r$tjt��d{���7�wxYw#d�wxYw�wrgrhrjs�r
razdAsyncioWaitForTest.test_wait_for_waits_for_task_cancellation_w_timeout_0.<locals>.foo.<locals>.inner�s[�����%�!�-�-��+�+�+�
!%�I�,���-�-��!�-�-��1�1�1����!%�I�rlrrA)rr$rrir%)rarprks  �r
r<zUAsyncioWaitForTest.test_wait_for_waits_for_task_cancellation_w_timeout_0.<locals>.foo�sQ�����
%�!�,�,�U�W�5�J��-�-��)�)�)��"�"�:�q�9�9�9�
*��9�s"�<A(�A$�A(�A&�A(�&A()	r=rr-r(rmrnr4ror)rr<rqrrrks    @r
�5test_wait_for_waits_for_task_cancellation_w_timeout_0zHAsyncioWaitForTest.test_wait_for_waits_for_task_cancellation_w_timeout_0�s|������	�
	:��
�
�w�3�3�
4���%�K�K�5�	
���	�"��,�,�*�*������g���(>�(>�?�	
��5�
4�s,�'B!�B�B�B�AB!�B�B�B!c���K�Gd�dt���fd�}|j��5|��d{���ddd�y7�
#1swYyxYw�w)Nc��eZdZy)�]AsyncioWaitForTest.test_wait_for_reraises_exception_during_cancellation.<locals>.FooExceptionN)rrrrr	r
�FooExceptionrz�s��r	r{c���K��fd�}tj|��}tj|t���d{���y7��w)Nc��\�K�	tjd��d{�����7�#��xYw�w)Nr�rr)r{s�r
razcAsyncioWaitForTest.test_wait_for_reraises_exception_during_cancellation.<locals>.foo.<locals>.inner�s0�����'�!�-�-��,�,�,�&�&�-��&�&�s �,�&�$�&�,�&�)�,rA)rr$r%ri)rarpr{s  �r
r<zTAsyncioWaitForTest.test_wait_for_reraises_exception_during_cancellation.<locals>.foo�s6�����
'�!�,�,�U�W�5�J��"�"�:�x�@�@�@�s�>A	�A�A	)�	Exceptionr=)rr<r{s  @r
�4test_wait_for_reraises_exception_during_cancellationzGAsyncioWaitForTest.test_wait_for_reraises_exception_during_cancellation�sF�����	�9�	�		A��
�
�|�
,��%�K�K�-�
,���-�
,�s+�&A�A�A�A�	A�A�A
�	Ac���K�tj���fd�}tj|��}tjtj||��}�j	|j
�|j
tj�5|�d{���ddd�|j|j��y7�,#1swY�+xYw�w)Nc��F�K��j�}|�d{���y7��wr)r2)r6r5s �r
�blocking_coroutinezDAsyncioWaitForTest._test_cancel_wait_for.<locals>.blocking_coroutine�s������$�$�&�C��I�I�s�!��!)
rr1r$r%r[r&r=rr(rH)rrBr�r\r'r5s     @r
�_test_cancel_wait_forz(AsyncioWaitForTest._test_cancel_wait_for�s�������'�'�)��	�
�"�"�#5�#7�8���"�"�7�#3�#3�D�'�#B�C�����t�{�{�#�
�
�
�w�5�5�
6��J�J�7�	
������(�)�
��7�
6�s0�BC�C� C
�!C�%(C�
C�C�Cc��BK�|jd��d{���y7��wr�r�rs r
�test_cancel_blocking_wait_forz0AsyncioWaitForTest.test_cancel_blocking_wait_for�������(�(��.�.�.�����c��BK�|jd��d{���y7��w)NgN@r�rs r
�test_cancel_wait_forz'AsyncioWaitForTest.test_cancel_wait_for�r�r�c��K�d�}tj|�d���d{���}|j|d�y7��w)Nc��~K�	tjd��d{���y7�#tj$rYywxYw�w)NrD�*)rrrrr	r
�	return_42zEAsyncioWaitForTest.test_wait_for_cancel_suppressed.<locals>.return_42s4����
��m�m�B�'�'�'���)�)�
��
�s(�=�$�"�$�=�$�:�=�:�=rMrAr�rU)rr�rVs   r
�test_wait_for_cancel_suppressedz2AsyncioWaitForTest.test_wait_for_cancel_suppressed�s9����	��$�$�Y�[�#�>�>������b�!�?�rXc��B��K�d�}tj|���d���fd�}tj|��}|j|j��tjd��d{���|j�|j
tj�5|�d{���ddd�|j�j��|j��d{���d�|j��y7��7�Y#1swY�XxYw7�+�w)Nc��K�y�wrQrrr	r
raz:AsyncioWaitForTest.test_wait_for_issue86296.<locals>.innerrSrTFc���K�tj�d���d{���tjd��d{���d�y7�$7�	�w)N�drAr`T)rr%r)rp�reached_ends��r
�
wait_for_corozBAsyncioWaitForTest.test_wait_for_issue86296.<locals>.wait_for_coros=������"�"�:�s�;�;�;��-�-��"�"�"��K�
<��"�s�A�A�A�A�A�Arr0)
rr$�assertFalser0rr&r=rr(r4)rrar�r\rpr�s    @@r
�test_wait_for_issue86296z+AsyncioWaitForTest.test_wait_for_issue86296s������
	��(�(���1�
���	��"�"�=�?�3���������%��m�m�A�������
�
�
�
�w�5�5�
6��J�J�7����
���)�*����z�)�6�2�����%�
	��
��7�
6��*�sH�A7D�;D
�<3D�/D�5D�6D�:7D�1D�2D�D�D�DN)rrrr+r.r8r>rIrNrWr]rdrsrwr�r�r�r�r�r�rr	r
r!r!(sY��	"�"�	$�
-�5�:-�*&�$�$�@�,@�2�$*�&/�/�
"� &r	r!c��eZdZd�Zd�Zd�Zy)�WaitForShieldTestsc��PK�d�}tj|��}|jtj�5tj|�}tj
|d���d{���ddd�|j
|j��|j
|j��|jj��tjd��d{���|j|j��y7��#1swY��xYw7�2�w)Nc��JK�tjd��d{���y7��w)Nrbr0r~rr	r
rRz2WaitForShieldTests.test_zero_timeout.<locals>.coro1s �����-�-��%�%�%��
&���#�!�#rrArM)rr$r=r-�shieldr%r�r0rHr(r)rrRr\�
shielded_tasks    r
�test_zero_timeoutz$WaitForShieldTests.test_zero_timeout*s�����	��"�"�4�6�*��
�
�
�w�3�3�
4�#�N�N�4�0�M��"�"�=�!�<�<�<�5�
	
�������%�������)�*����
�/�/�1�2��m�m�C� � � �����	�	��$�
=��5�
4��	!�s;�=D&�0D�/D�0D�4A=D&�1D$�2$D&�D�D!�D&c��$K�d�}tj|��}tjtj|�d���d{���|j	|j��|j
|�d{���d�y7�>7��w)Nc��JK�tjd��d{���y7��w�NrMr0r~rr	r
rRz2WaitForShieldTests.test_none_timeout.<locals>.coroG� �����-�-��$�$�$��
%�r�rAr0)rr$r%r�r(r0r4�rrRr\s   r
�test_none_timeoutz$WaitForShieldTests.test_none_timeoutDsn����	��"�"�4�6�*�����w�~�~�d�3�T�B�B�B�����	�	��$����t��V�,�	C��$�s$�AB�
B�3B�B�B�Bc���K�d�}tj|��}|jtj�5tjtj
|�d���d{���ddd�|j
|j��|j
|j��|j|�d{���d�y7�e#1swY�dxYw7��w)Nc��JK�tjd��d{���y7��wr�r~rr	r
rRz6WaitForShieldTests.test_shielded_timeout.<locals>.coroSr�r�rbrAr0)
rr$r=r-r%r�r�r0rHr4r�s   r
�test_shielded_timeoutz(WaitForShieldTests.test_shielded_timeoutQs�����	��"�"�4�6�*��
�
�
�w�3�3�
4��"�"�7�>�>�$�#7��F�F�F�5�	
�������%�������)�*����t��V�,�	
G��5�
4��
$�s;�=C#�.C�-C�.C�2AC#�C!�	
C#�C�C�C#N)rrrr�r�r�rr	r
r�r�(s��%�4-�-r	r��__main__)
r�unittestr�testrrrir
�IsolatedAsyncioTestCaser!r�r�mainrr	r
�<module>r�si������(�����.}&��9�9�}&�@5-��9�9�5-�p�z���H�M�M�O�r	

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists