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

�

(ΜgZ���dZddlZddlZddlmZddlmZd�ZGd�dej�Ze	dk(rej�yy)	zTests for asyncio/threads.py�N)�
ContextVar)�mockc�.�tjd�y�N)�asyncio�set_event_loop_policy���;/usr/local/lib/python3.12/test/test_asyncio/test_threads.py�tearDownModuler
s���!�!�$�'r
c�0�eZdZd�Zd�Zd�Zd�Zd�Zd�Zy)�
ToThreadTestsc��|K�tjtddg��d{���}|j|d�y7��w)N�(��*)r�	to_thread�sum�assertEqual)�self�results  r�test_to_threadzToThreadTests.test_to_threads4�����(�(��r�1�g�6�6�������$�7�s� <�:�<c��K�d�}|jtd�5tj|��d{���ddd�y7�
#1swYyxYw�w)Nc��td��)N�test)�RuntimeErrorr	r
r�
raise_runtimez=ToThreadTests.test_to_thread_exception.<locals>.raise_runtimes
���v�&�&r
r)�assertRaisesRegexrrr)rrs  r�test_to_thread_exceptionz&ToThreadTests.test_to_thread_exceptionsE����	'��
#�
#�L�&�
9��#�#�M�2�2�2�:�
9�2��:�
9�s+�A�A�A�A�	A�A�A�
Ac��K�tj�}tj|��d{���|j	�y7��wr)r�Mockrr�assert_called_once�r�funcs  r�test_to_thread_oncez!ToThreadTests.test_to_thread_onces6�����y�y�{������%�%�%����!�	&�s�-A�A�Ac��K�tj�}g}td�D](}tj|�}|j|��*tj|��d{���|j|jd�y7�!�w)N�
)	rr!�rangerr�append�gatherr�
call_count)rr$�futs�_�futs     r�test_to_thread_concurrentz'ToThreadTests.test_to_thread_concurrent sm�����y�y�{�����r��A��#�#�D�)�C��K�K�����n�n�d�#�#�#�������"�-�	$�s�A"B�$B�%"Bc��K�tj�}tj|dd���d{���|j	dd��y7��w)NrT)�	something)rr!rr�assert_called_once_withr#s  r�test_to_thread_args_kwargsz(ToThreadTests.test_to_thread_args_kwargs+sA�����y�y�{������f��=�=�=��$�$�V�t�$�<�	>�s�0A
�A�A
c���K�td���fd�}�jd�tj|��d{���}|j	|d�y7��w)N�test_ctxc�$���j�Sr)�get)r5s�r�get_ctxz9ToThreadTests.test_to_thread_contextvars.<locals>.get_ctx6s����<�<�>�!r
�parrot)r�setrrr)rr8rr5s   @r�test_to_thread_contextvarsz(ToThreadTests.test_to_thread_contextvars3sL������j�)��	"�	���X���(�(��1�1�������*�2�s�:A�A�AN)	�__name__�
__module__�__qualname__rrr%r/r3r;r	r
rrrs ��%�3�"�	.�=�	+r
r�__main__)�__doc__r�unittest�contextvarsrrr�IsolatedAsyncioTestCaserr<�mainr	r
r�<module>rEsF��"���"��(�.+�H�4�4�.+�b�z���H�M�M�O�r

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