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_pep492.cpython-312.pyc

�

(Μg�����dZddlZddlZddlZddlmZddlZddlmZd�Z	Gd�d�Z
Gd�d	ej�ZGd
�de�Z
Gd�d
e�ZGd�de�Zedk(rej"�yy)z3Tests support for new syntax introduced by PEP 492.�N)�mock)�utilsc�.�tjd�y�N)�asyncio�set_event_loop_policy���:/usr/local/lib/python3.12/test/test_asyncio/test_pep492.py�tearDownModuler
s���!�!�$�'r
c�&�eZdZd�Zdd�Zd�Zd�Zy)�FakeCoroc��yrr	)�self�values  r�sendz
FakeCoro.send���r
Nc��yrr	)r�typ�val�tbs    r�throwzFakeCoro.throwrr
c��yrr	�rs r�closezFakeCoro.closerr
c#�K�d��y�wrr	rs r�	__await__zFakeCoro.__await__s	����
���)NN)�__name__�
__module__�__qualname__rrrrr	r
rrrs��
�
�
�r
rc���eZdZ�fd�Z�xZS)�BaseTestc�`��t�|��tj�|_tj�|j_tj�|j_d|jjj_
|j|j�y)Nr	)�super�setUpr�
BaseEventLoop�loopr�Mock�_process_events�	_selector�select�return_value�set_event_loop)r�	__class__s �rr&zBaseTest.setUp"sj���
��
���)�)�+��	�$(�I�I�K��	�	�!�"�i�i�k��	�	��24��	�	���"�"�/����D�I�I�&r
)rr r!r&�
__classcell__)r/s@rr#r# s
���'�'r
r#c��eZdZd�Zd�Zy)�	LockTestsc�:��tj�tj�tj�tj�g}�fd�}|D]B}�j
j
||���j|j���Dy)Nc���K�tjd��d{����j|j��|4�d{���}�j	|d��j|j��tjd��d{����j|j��ddd��d{����j|j��y7��7��7�W7�*#1�d{���7swY�:xYw�w)N�{�G�z�?)r�sleep�assertFalse�locked�assertIs�
assertTrue)�lock�_lockrs  �r�testz7LockTests.test_context_manager_async_with.<locals>.test5s�������-�-��%�%�%����T�[�[�]�+��t�u��
�
�e�T�*�������
�.��m�m�D�)�)�)�������
�.�	�t�

���T�[�[�]�+�
&����*����t�t�t�sj�D�C(�)D�C*�D�
A
C0�C,�#C0�8D�C.�%D�*D�,C0�.D�0D�6C9�7D�>D�	r�Lock�	Condition�	Semaphore�BoundedSemaphorer(�run_until_completer7r8�r�
primitivesr=�	primitives`   r�test_context_manager_async_withz)LockTests.test_context_manager_async_with-su����L�L�N����������$�$�&�	
�
�	,�$�I��I�I�(�(��i��9����Y�-�-�/�0�$r
c�:��tj�tj�tj�tj�g}�fd�}|D]B}�j
j
||���j|j���Dy)Nc��$�K�tjd��d{����j|j���j	t
d�5|�d{���5	ddd�ddd�y7�W7�#1swY�xYw#1swYyxYw�w)Nr5z#can't be used in 'await' expression)rr6r7r8�assertRaisesRegex�	TypeError)r;rs �rr=z7LockTests.test_context_manager_with_await.<locals>.testKsw������-�-��%�%�%����T�[�[�]�+��'�'��5�� �Z�Z�� �	��
&�� ��Z�Z��	��sQ�B�A4�9B�B�A6�B�!A8�#B�+
B�6B�8B	�=B�B
�	Br>rDs`   r�test_context_manager_with_awaitz)LockTests.test_context_manager_with_awaitCsu����L�L�N����������$�$�&�	
�
�	�$�I��I�I�(�(��i��9����Y�-�-�/�0�$r
N)rr r!rGrLr	r
rr2r2+s��1�,1r
r2c��eZdZd�Zy)�StreamReaderTestsc���d}tj|j����j|��j	��fd�}|jj|��}|j
|gd��y)Nsline1
line2
line3�r(c��T�K�g}�23d{���}|j|��7�6|S�wr)�append)�data�line�streams  �r�readerz/StreamReaderTests.test_readline.<locals>.readercs/������D�$�
"�d����D�!�
"��f��K�s�(�%�#�%�(�%�()sline1
sline2
sline3)r�StreamReaderr(�	feed_data�feed_eofrC�assertEqual)r�DATArVrSrUs    @r�
test_readlinezStreamReaderTests.test_readline\sb���%���%�%�4�9�9�5�����������	��y�y�+�+�F�H�5������A�Br
N)rr r!r\r	r
rrNrNZs��Cr
rNc�<�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
y	)
�CoroutineTestsc��d�}|�}	|jtj|��|j�|jtjt	���y#|j�wxYw)Nc��K�y�wrr	r	r
r�fooz,CoroutineTests.test_iscoroutine.<locals>.foop��������)r:r�iscoroutinerr)rra�fs   r�test_iscoroutinezCoroutineTests.test_iscoroutineosW����E��	��O�O�G�/�/��2�3�
�G�G�I�����+�+�H�J�7�8��
�G�G�I�s�$A-�-A?c�\�d�}|jtj|���y)Nc3�K�d��y�wrr	r	r
rraz6CoroutineTests.test_iscoroutine_generator.<locals>.foo{s����5�r)r7rrd�rras  r�test_iscoroutine_generatorz)CoroutineTests.test_iscoroutine_generatorzs �������,�,�S�U�3�4r
c�R�d�}|jtj|��y)Nc��K�y�wrr	r	r
rraz4CoroutineTests.test_iscoroutinefunction.<locals>.foo�rbrc)r:r�iscoroutinefunctionris  r�test_iscoroutinefunctionz'CoroutineTests.test_iscoroutinefunction�s�������3�3�C�8�9r
c���d���fd�}|jj|��}|j|d�|jjd�|jj|��}|j|d�y)Nc��K�y�w)N�spamr	r	r
r�barz5CoroutineTests.test_async_def_coroutines.<locals>.bar�s	�����rcc��.�K����d{���S7��wrr	)rrs�rraz5CoroutineTests.test_async_def_coroutines.<locals>.foo�s�������;��;�s���rqT)r(rCrZ�	set_debug)rrarSrrs   @r�test_async_def_coroutinesz(CoroutineTests.test_async_def_coroutines�so���	�	��y�y�+�+�C�E�2������v�&�	
�	�	���D�!��y�y�+�+�C�E�2������v�&r
c����fd�}�jtj�d��jj	d��jj|���jtj�d�y)Nc��Z�K��jtj�dkD�y�w�Nr)r:�sys�#get_coroutine_origin_tracking_depthrs�r�startzOCoroutineTests.test_debug_mode_manages_coroutine_origin_tracking.<locals>.start�s!������O�O�C�C�C�E��I�J�s�(+rT)rZryrzr(rtrC)rr{s` r�1test_debug_mode_manages_coroutine_origin_trackingz@CoroutineTests.test_debug_mode_manages_coroutine_origin_tracking�sc���	K�	
����@�@�B�A�F��	�	���D�!��	�	�$�$�U�W�-�����@�@�B�A�Fr
c�����d��tj�fd�����fd�}�jj|��}�j	|d�y)Nc3�$K�dEd{���y7��w)Nr	rqr	r	r
r�genz0CoroutineTests.test_types_coroutine.<locals>.gen�s�����M�M��
�s���c�����Srr	)rs�r�funcz1CoroutineTests.test_types_coroutine.<locals>.func�s
����5�Lr
c��r�K���}�j|tj�|�d{���S7��wr)�assertIsInstance�types�_GeneratorWrapper)�wrapperr�rs ��r�coroz1CoroutineTests.test_types_coroutine.<locals>.coro�s.������f�G��!�!�'�5�+B�+B�C� �=� �=�s�-7�5�7rq)r��	coroutiner(rCrZ)rr�rSr�rs`  @@r�test_types_coroutinez#CoroutineTests.test_types_coroutine�sM���	�
���	�
�	�	!�
�y�y�+�+�D�F�3������v�&r
c�h����d���fd�����fd�}�jj|��y)Nc���K��jd��}	�j|djjd�d}y#d}wxYw�w)N�)�limitrra)�	get_stackrZ�f_code�co_name)re�Trs ��rraz1CoroutineTests.test_task_print_stack.<locals>.foo�sD��������!��$�A�
�� � ��1����!4�!4�e�<����D��s�A
�)A�A
�A�A
c��r�K�tj���j�����d{���y7��w)NrP)r�
ensure_futurer()r�rars���r�runnerz4CoroutineTests.test_task_print_stack.<locals>.runner�s&������%�%�c�e�$�)�)�<�A��G�G�s�,7�5�7)r(rC)rr�r�ras` @@r�test_task_print_stackz$CoroutineTests.test_task_print_stack�s(�����	�	�
	
�	�	�$�$�V�X�.r
c�����d����fd�}�jjd��jtd��5�jj	|��ddd�y#1swYyxYw)Nc��JK�tjd��d{���y7��w)Ng�������?)rr6r	r
r�afuncz/CoroutineTests.test_double_await.<locals>.afunc�s�����-�-��$�$�$�s�#�!�#c����K���}�jj|�}	tjd��d{���|�d{���|j	�y7�7�#|j	�wxYw�wrx)r(�create_taskrr6�cancel)r��tr�rs  ��rr�z0CoroutineTests.test_double_await.<locals>.runner�s\������7�D��	�	�%�%�d�+�A�
��m�m�A�&�&�&��
�
����
�'�������
�s?�#A8�A#�A�	A#�	A!�
A#�A8�A#�!A#�#A5�5A8Tz"coroutine is being awaited already)�msg)r(rt�assertRaises�RuntimeErrorrC)rr�r�s` @r�test_double_awaitz CoroutineTests.test_double_await�s`���	%�	�	
�	�	���D�!�
�
�
��8��:�
�I�I�(�(���2�	:�:�:�s�!A(�(A1N)rr r!rfrjrnrur|r�r�r�r	r
rr^r^ms+��	9�5�:�
'�G�'�"/�"3r
r^�__main__)�__doc__ryr��unittestrr�test.test_asyncior�
test_utilsrr�TestCaser#r2rNr^r�mainr	r
r�<module>r�s��9�
�����1�(�
��'�z�"�"�'�,1��,1�^C��C�&c3�X�c3�L�z���H�M�M�O�r

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