HEX
Server: Microsoft-IIS/10.0
System: Windows NT ITPWINWEBSVR22 10.0 build 20348 (Windows Server 2022) AMD64
User: www.conferencesearch.co.uk (0)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: D:/Python311/Lib/test/test_asyncio/__pycache__/test_waitfor.cpython-311.pyc
�

��Vc#���ddlZddlZddlZd�ZdZGd�d��ZGd�dej��Zedkrej	��dSdS)	�Nc�.�tjd��dS�N)�asyncio�set_event_loop_policy���2D:\Python311\Lib\test\test_asyncio\test_waitfor.py�tearDownModuler
s���!�$�'�'�'�'�'rg-C��6?c�"�eZdZdZdZd�Zd�ZdS)�SlowTaskz? Task will run for this defined time, ignoring cancel requests 皙�����?c��d|_dS)NF)�exited��selfs r	�__init__zSlowTask.__init__s
������rc���K�tj��|jz}	|tj��z
}|dkrn2	tj|���d{V��n#tj$rYnwxYw�Od|_dS)NTr)�time�	monotonic�TASK_TIMEOUTr�sleep�CancelledErrorr)r�exitat�tosleeps   r	�runzSlowTask.runs�������!�!�D�$5�5��	��t�~�/�/�/�G��!�|�
��
��m�G�,�,�,�,�,�,�,�,�,�,���)�
�
�
���
����	�����s�A�A*�)A*N)�__name__�
__module__�__qualname__�__doc__rrrrrr	rrs=������I�I��L����
�
�
�
�
rrc�n�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�ZdS)�AsyncioWaitForTestc��nK�t��}tjtj|���|jdz����}tjd���d{V��|���tj|h���d{V��|�	|j
��dS)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�J���)���Q�U�U�W�W�a�n�q�&8�9�9�;�;���m�A�����������������l�K�=�)�)�)�)�)�)�)�)�)������!�!�!�!�!rc���K�t��}	tj|���|jdz���d{V��n#tj$rYnwxYw|�|j��dS)Nr#)rrr%rr�TimeoutErrorr(r)rr)s  r	�test_asyncio_wait_for_timeoutz0AsyncioWaitForTest.test_asyncio_wait_for_timeout4s������J�J��	��"�1�5�5�7�7�A�N�Q�,>�?�?�?�?�?�?�?�?�?�?���#�	�	�	��D�	����	
�����!�!�!�!�!s�5A�A�Ac��K�tj��}|���}|�d��|���}tj|d���d{V��}|���}|�|d��|�|�����|�	||z
d��dS)N�doner皙�����?)
r�get_running_loop�
create_future�
set_resultrr%�assertEqualr(r0�
assertLess)r�loop�fut�t0�ret�t1s      r	�2test_wait_for_timeout_less_then_0_or_0_future_donezEAsyncioWaitForTest.test_wait_for_timeout_less_then_0_or_0_future_done>s������'�)�)��� � �"�"�����v����
�Y�Y�[�[���$�S�!�,�,�,�,�,�,�,�,��
�Y�Y�[�[������f�%�%�%�������
�
�#�#�#�����R���%�%�%�%�%rc���K�tj��}d��fd�}|�tj��5|���}tj|��d���d{V��ddd��n#1swxYwY|���}|��d��|�||z
d��dS)NFc���K�d�dS)NTr)�foo_starteds�r	�fooz_AsyncioWaitForTest.test_wait_for_timeout_less_then_0_or_0_coroutine_do_not_started.<locals>.fooQs������K�K�Krrr1)rr2�assertRaisesr-rr%r5r6)rr7r@r9r;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_startedLs������'�)�)����	�	�	�	�	��
�
�w�3�
4�
4�	-�	-������B��"�3�3�5�5�!�,�,�,�,�,�,�,�,�,�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-����	-�	-�	-�	-��Y�Y�[�[������e�,�,�,�����R���%�%�%�%�%s�8B�B�Bc����K�tj��}dD�]h}|�|���5d�|������fd�}tj|����}��d{V��|�tj��5|���}tj||���d{V��ddd��n#1swxYwY|���}|�	|�
����|�	|�����|��d��|�
||z
d��ddd��n#1swxYwY��jdS)N)r�����timeoutc���K�d���d��	tjd���d{V��d�n#d�wxYwdS�NT�
Fr0)r4rr)�foo_running�starteds��r	r@zFAsyncioWaitForTest.test_wait_for_timeout_less_then_0_or_0.<locals>.fooesd�����"&�K��&�&�t�,�,�,�,�%�m�B�/�/�/�/�/�/�/�/�/�&+����e��+�+�+�+�!�6s�9�=Fr1)rr2�subTestr3r$rAr-rr%r(r0�	cancelledr5r6)	rr7rFr@r8r9r;rJrKs	       @@r	�&test_wait_for_timeout_less_then_0_or_0z9AsyncioWaitForTest.test_wait_for_timeout_less_then_0_or_0]s�������'�)�)���	.�	.�G����g��.�.�
.�
.�"���,�,�.�.��"�"�"�"�"�"��)�#�#�%�%�0�0���
�
�
�
�
�
�
��&�&�w�';�<�<�9�9������B�!�*�3��8�8�8�8�8�8�8�8�8�9�9�9�9�9�9�9�9�9�9�9����9�9�9�9��Y�Y�[�[��������
�
�+�+�+�����
�
���0�0�0�� � ��e�4�4�4�����R���-�-�-�5
.�
.�
.�
.�
.�
.�
.�
.�
.�
.�
.����
.�
.�
.�
.��	.�	.s7�A E7�0C�E7�C�E7�C�BE7�7E;	�>E;	c��f�K�tj��}d��fd�}tj|����}|�tj��5|���}tj|d���d{V��ddd��n#1swxYwY|���}|�|�����|�|�	����|�
||z
d��|��d��dS)Nc��Z�K�d�	tjd���d{V��d�n#d�wxYwdSrH�rr)rJs�r	r@z-AsyncioWaitForTest.test_wait_for.<locals>.foo�sP������K�
$��m�B�'�'�'�'�'�'�'�'�'�#����e��#�#�#�#��6s�$�(r1g�?F)rr2r$rAr-rr%r(r0rMr6r5)rr7r@r8r9r;rJs      @r	�
test_wait_forz AsyncioWaitForTest.test_wait_for}s`������'�)�)����	�	�	�	�	��!�#�#�%�%�(�(��
�
�
�w�3�
4�
4�	-�	-������B��"�3��,�,�,�,�,�,�,�,�,�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�	-����	-�	-�	-�	-��Y�Y�[�[��������
�
�#�#�#�����
�
���(�(�(�����R���%�%�%�����e�,�,�,�,�,s�0B�B�Bc��K�d�}tj|��d����d{V��}|�|d��dS)Nc��
K�dS)Nr0rrrr	�coroz7AsyncioWaitForTest.test_wait_for_blocking.<locals>.coro�s�����6rrEr0�rr%r5)rrU�ress   r	�test_wait_for_blockingz)AsyncioWaitForTest.test_wait_for_blocking�s`����	�	�	��$�T�T�V�V�T�:�:�:�:�:�:�:�:�:������f�%�%�%�%�%rc��K�tj��}|���}tj|d���}|�d|jd��|�d{V��}|�|d��dS)Nr
rEr1�ok)rr2r3r%�
call_laterr4r5)rr7r8�taskrWs     r	�test_wait_for_race_conditionz/AsyncioWaitForTest.test_wait_for_race_condition�s�����'�)�)��� � �"�"�����S�1�1�1������S�^�T�2�2�2��j�j�j�j�j�j������d�#�#�#�#�#rc���K��fd�}tj|��d����d{V��}��|d��dS)Nc���K���tj��5tjd���d{V��ddd��n#1swxYwYdS)N�)rArrrrs�r	�innerzKAsyncioWaitForTest.test_wait_for_cancellation_race_condition.<locals>.inner�s�������"�"�7�#9�:�:�
'�
'��m�A�&�&�&�&�&�&�&�&�&�
'�
'�
'�
'�
'�
'�
'�
'�
'�
'�
'����
'�
'�
'�
'��1s�A
�
A�Ag{�G�z�?rEr`rV)rra�results`  r	�)test_wait_for_cancellation_race_conditionz<AsyncioWaitForTest.test_wait_for_cancellation_race_condition�sk�����	�	�	�	�	�
�'������=�=�=�=�=�=�=�=�=�������#�#�#�#�#rc���K�d��fd�}tj|����}|�tj��5}tj|t
����d{V��ddd��n#1swxYwY|����|jj}|�	t|��tj��dS)NFc���K�	tjd���d{V��n3#tj$r!tjt���d{V���wxYw	d�dS#d�wxYw�NrIT�rrr�_EPSILON��	task_dones�r	razKAsyncioWaitForTest.test_wait_for_waits_for_task_cancellation.<locals>.inner�s������
!��m�B�'�'�'�'�'�'�'�'�'�'���)�
�
�
��m�H�-�-�-�-�-�-�-�-�-��
����(�
!�	�	�	��D�	� � � � �� �A�0A�A�ArE)rr$rAr-r%rhr(�	exception�__context__r5�typer)rra�
inner_task�cm�chainedrjs     @r	�)test_wait_for_waits_for_task_cancellationz<AsyncioWaitForTest.test_wait_for_waits_for_task_cancellation�s!������	�	!�	!�	!�	!�	!��(�����1�1�
�
�
�
�w�3�
4�
4�	A���"�:�x�@�@�@�@�@�@�@�@�@�@�	A�	A�	A�	A�	A�	A�	A�	A�	A�	A�	A����	A�	A�	A�	A�	
���	�"�"�"��,�*������g����(>�?�?�?�?�?s�"A4�4A8�;A8c��D�K�d��fd�}|�tj��5}|���d{V��ddd��n#1swxYwY|����|jj}|�t|��tj��dS)NFc����K��fd�}tj|����}tjt���d{V��tj|d����d{V��dS)Nc���K�	tjd���d{V��n3#tj$r!tjt���d{V���wxYw	d�dS#d�wxYwrfrgris�r	razdAsyncioWaitForTest.test_wait_for_waits_for_task_cancellation_w_timeout_0.<locals>.foo.<locals>.inner�s������%�!�-��+�+�+�+�+�+�+�+�+�+���-����!�-��1�1�1�1�1�1�1�1�1������,�
!%�I�I�I���I�$�$�$�$rkrrE)rr$rrhr%)rarorjs  �r	r@zUAsyncioWaitForTest.test_wait_for_waits_for_task_cancellation_w_timeout_0.<locals>.foo�s������
%�
%�
%�
%�
%�!�,�U�U�W�W�5�5�J��-��)�)�)�)�)�)�)�)�)��"�:�q�9�9�9�9�9�9�9�9�9�9�9�9r)	rArr-r(rlrmr5rnr)rr@rprqrjs    @r	�5test_wait_for_waits_for_task_cancellation_w_timeout_0zHAsyncioWaitForTest.test_wait_for_waits_for_task_cancellation_w_timeout_0�s�������	�
	:�
	:�
	:�
	:�
	:��
�
�w�3�
4�
4�	���#�%�%�K�K�K�K�K�K�K�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	
���	�"�"�"��,�*������g����(>�?�?�?�?�?s�A�A�Ac���K�Gd�dt����fd�}|����5|���d{V��ddd��dS#1swxYwYdS)Nc��eZdZdS)�]AsyncioWaitForTest.test_wait_for_reraises_exception_during_cancellation.<locals>.FooExceptionN)rrrrrr	�FooExceptionry�s�������Drrzc���K��fd�}tj|����}tj|t����d{V��dS)Nc��N�K�	tjd���d{V����#��xYw)Nr
rQ)rzs�r	razcAsyncioWaitForTest.test_wait_for_reraises_exception_during_cancellation.<locals>.foo.<locals>.inner�sC�����'�!�-��,�,�,�,�,�,�,�,�,�&�&��,�&�&�&�&s�!�$rE)rr$r%rh)rarorzs  �r	r@zTAsyncioWaitForTest.test_wait_for_reraises_exception_during_cancellation.<locals>.foo�sf�����
'�
'�
'�
'�
'�!�,�U�U�W�W�5�5�J��"�:�x�@�@�@�@�@�@�@�@�@�@�@�@r)�	ExceptionrA)rr@rzs  @r	�4test_wait_for_reraises_exception_during_cancellationzGAsyncioWaitForTest.test_wait_for_reraises_exception_during_cancellation�s������	�	�	�	�	�9�	�	�	�		A�		A�		A�		A�		A��
�
�|�
,�
,�	�	��#�%�%�K�K�K�K�K�K�K�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�A�A�Ac��K�d�}tj|����}tj|d���}tj|��}tjd���d{V��|���|�tj��5|�d{V��ddd��n#1swxYwY|�|�d{V��d��dS)Nc��K�	tjd���d{V��n`#tj$rN	tjd���d{V��n/#tj$rtjd���d{V��YnwxYwYnwxYwdS)Ng333333�?�*)rrrrrr	razAAsyncioWaitForTest.test_wait_for_self_cancellation.<locals>.inner�s�����
-��m�C�(�(�(�(�(�(�(�(�(�(���)�
-�
-�
-�-�!�-��,�,�,�,�,�,�,�,�,�,���-�-�-�-�!�-��,�,�,�,�,�,�,�,�,�,�,�-������
-�����2s2��A<�A
�	A<�
)A6�3A<�5A6�6A<�;A<r1rEr
r�)rr$r%rr&rArr5)rraror'r\s     r	�test_wait_for_self_cancellationz2AsyncioWaitForTest.test_wait_for_self_cancellation�s0����		�		�		��(�����1�1�
���
�C�8�8�8���"�4�(�(���m�C� � � � � � � � � ����
�
�
�
�
�
�w�5�
6�
6�	�	��J�J�J�J�J�J�J�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	
���z�)�)�)�)�)�)�2�.�.�.�.�.s�	B.�.B2�5B2c����K�tj����fd�}tj|����}tjtj||����}��|j��|�tj��5|�d{V��ddd��n#1swxYwY|�|�	����dS)Nc��D�K�����}|�d{V��dSr)r3)r8r7s �r	�blocking_coroutinezDAsyncioWaitForTest._test_cancel_wait_for.<locals>.blocking_coroutines-������$�$�&�&�C��I�I�I�I�I�I�I�I�Ir)
rr2r$r%�	call_soonr&rArr(rM)rrFr�r\r'r7s     @r	�_test_cancel_wait_forz(AsyncioWaitForTest._test_cancel_wait_fors������'�)�)��	�	�	�	�	�
�"�#5�#5�#7�#7�8�8���"�7�#3�D�'�#B�#B�C�C�����t�{�#�#�#�
�
�
�w�5�
6�
6�	�	��J�J�J�J�J�J�J�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	
������(�(�)�)�)�)�)s�	B-�-B1�4B1c��@K�|�d���d{V��dSr�r�rs r	�test_cancel_blocking_wait_forz0AsyncioWaitForTest.test_cancel_blocking_wait_for�2�����(�(��.�.�.�.�.�.�.�.�.�.�.rc��@K�|�d���d{V��dS)NgN@r�rs r	�test_cancel_wait_forz'AsyncioWaitForTest.test_cancel_wait_for!r�rN)rrrr+r.r<rBrNrRrXr]rcrrrvr~r�r�r�r�rrr	r!r!'s������	"�	"�	"�"�"�"�&�&�&�&�&�&�".�.�.�@-�-�-�2&�&�&�$�$�$�$�$�$�@�@�@�,@�@�@�2���$/�/�/�6*�*�*�&/�/�/�/�/�/�/�/rr!�__main__)
r�unittestrr
rhr�IsolatedAsyncioTestCaser!r�mainrrr	�<module>r�s���������������(�(�(�����������.{/�{/�{/�{/�{/��9�{/�{/�{/�|�z����H�M�O�O�O�O�O��r