Your IP : 3.145.88.104


Current Path : /opt/alt/python311/lib64/python3.11/unittest/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/unittest/__pycache__/async_case.cpython-311.pyc

�

c��fY��N�ddlZddlZddlZddlZddlmZGd�de��ZdS)�N�)�TestCasec���eZdZd�fd�	Zd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�fd�	Z�fd�Zd�Z�xZS)�IsolatedAsyncioTestCase�runTestc���t���|��d|_tj��|_dS�N)�super�__init__�_asyncioRunner�contextvars�copy_context�_asyncioTestContext)�self�
methodName�	__class__s  ��:/opt/alt/python311/lib64/python3.11/unittest/async_case.pyrz IsolatedAsyncioTestCase.__init__#s:���
������$�$�$�"���#.�#;�#=�#=�� � � �c��
K�dSr	��rs r�
asyncSetUpz"IsolatedAsyncioTestCase.asyncSetUp(������rc��
K�dSr	rrs r�
asyncTearDownz%IsolatedAsyncioTestCase.asyncTearDown+rrc�(�|j|g|�Ri|��dSr	)�
addCleanup�r�func�args�kwargss    r�addAsyncCleanupz'IsolatedAsyncioTestCase.addAsyncCleanup.s)��	���$�����1�&�1�1�1�1�1rc��K�t|��}	|j}|j}n/#t$r"t	d|j�d|j�d���d�wxYw||���d{V��}|�||ddd��|S)z�Enters the supplied asynchronous context manager.

        If successful, also adds its __aexit__ method as a cleanup
        function and returns the result of the __aenter__ method.
        �'�.zC' object does not support the asynchronous context manager protocolN)�type�
__aenter__�	__aexit__�AttributeError�	TypeError�
__module__�__qualname__r")r�cm�cls�enter�exit�results      r�enterAsyncContextz)IsolatedAsyncioTestCase.enterAsyncContext=s������2�h�h��	'��N�E��=�D�D���	'�	'�	'��U���U�U��1A�U�U�U���"&�
'�	'�����u�R�y�y�����������T�2�t�T�4�8�8�8��
s	�"�,Ac��|j���|j�|j��|�|j��dSr	)r�get_loopr�run�setUp�
_callAsyncrrs r�
_callSetUpz"IsolatedAsyncioTestCase._callSetUpQsL��	
��$�$�&�&�&�� �$�$�T�Z�0�0�0������(�(�(�(�(rc�t�|�|���"tjd|�d�td���dSdS)NzFIt is deprecated to return a value that is not None from a test case (�)�)�
stacklevel)�_callMaybeAsync�warnings�warn�DeprecationWarning)r�methods  r�_callTestMethodz'IsolatedAsyncioTestCase._callTestMethodYsd������'�'�3��M�2�(.�2�2�2�3E�RS�
U�
U�
U�
U�
U�
U�4�3rc�x�|�|j��|j�|j��dSr	)r7rrr5�tearDownrs r�
_callTearDownz%IsolatedAsyncioTestCase._callTearDown^s6������*�+�+�+�� �$�$�T�]�3�3�3�3�3rc�(�|j|g|�Ri|��dSr	)r=)r�functionr r!s    r�_callCleanupz$IsolatedAsyncioTestCase._callCleanupbs+�����X�7��7�7�7��7�7�7�7�7rc��|j�
Jd���tj|��s
J|�d����|j�||i|��|j���S)N�!asyncio runner is not initializedz is not an async function��context�r�inspect�iscoroutinefunctionr5rrs    rr7z"IsolatedAsyncioTestCase._callAsyncesz���"�.�.�0S�.�.�.��*�4�0�0�V�V�T�2V�2V�2V�V�V�0��"�&�&��D�$�!�&�!�!��,�'�
�
�	
rc���|j�
Jd���tj|��r'|j�||i|��|j���S|jj|g|�Ri|��S)NrJrKrMrs    rr=z'IsolatedAsyncioTestCase._callMaybeAsyncms����"�.�.�0S�.�.�.��&�t�,�,�	G��&�*�*���d�%�f�%�%��0�+���
�
0�4�+�/��F�t�F�F�F�v�F�F�Frc�`�|j�
Jd���tjd���}||_dS)Nz%asyncio runner is already initializedT)�debug)r�asyncio�Runner�r�runners  r�_setupAsyncioRunnerz+IsolatedAsyncioTestCase._setupAsyncioRunnerws:���"�*�*�,S�*�*�*���d�+�+�+��$����rc�<�|j}|���dSr	)r�closerUs  r�_tearDownAsyncioRunnerz.IsolatedAsyncioTestCase._tearDownAsyncioRunner|s���$���������rNc����|���	t���|��|���S#|���wxYwr	)rWr
r5rZ)rr1rs  �rr5zIsolatedAsyncioTestCase.run�sZ���� � �"�"�"�	*��7�7�;�;�v�&�&��'�'�)�)�)�)��D�'�'�)�)�)�)���s� A�A"c���|���t�����|���dSr	)rWr
rRrZ)rrs �rrRzIsolatedAsyncioTestCase.debug�s>���� � �"�"�"�
���
�
�����#�#�%�%�%�%�%rc�@�|j�|���dSdSr	)rrZrs r�__del__zIsolatedAsyncioTestCase.__del__�s+����*��'�'�)�)�)�)�)�+�*r)rr	)�__name__r+r,rrrr"r2r8rBrErHr7r=rWrZr5rRr^�
__classcell__)rs@rrr	s=�������4>�>�>�>�>�>�

�
�
�
�
�
�
2�
2�
2����()�)�)�U�U�U�
4�4�4�8�8�8�
�
�
�G�G�G�%�%�%�
���*�*�*�*�*�*�&�&�&�&�&�
*�*�*�*�*�*�*rr)rSr
rNr>�caserrrrr�<module>rbs|������������������������E*�E*�E*�E*�E*�h�E*�E*�E*�E*�E*r

?>