AlkantarClanX12

Your IP : 3.129.216.15


Current Path : /proc/self/root/usr/lib64/python3.8/unittest/__pycache__/
Upload File :
Current File : //proc/self/root/usr/lib64/python3.8/unittest/__pycache__/async_case.cpython-38.pyc

U

e5d��@s0ddlZddlZddlmZGdd�de�ZdS)�N�)�TestCasecs�eZdZd�fdd�	Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zd �fdd�	Z�ZS)!�IsolatedAsyncioTestCase�runTestcst��|�d|_d|_dS�N)�super�__init__�_asyncioTestLoop�_asyncioCallsQueue)�selfZ
methodName��	__class__��+/usr/lib64/python3.8/unittest/async_case.pyr"sz IsolatedAsyncioTestCase.__init__c�sdSrr�rrrr�
asyncSetUp'sz"IsolatedAsyncioTestCase.asyncSetUpc�sdSrrrrrr�
asyncTearDown*sz%IsolatedAsyncioTestCase.asyncTearDowncOs|j|f|�|�dSr)Z
addCleanup)r�func�args�kwargsrrr�addAsyncCleanup-s
z'IsolatedAsyncioTestCase.addAsyncCleanupcCs|��|�|j�dSr)ZsetUp�
_callAsyncrrrrr�
_callSetUp<sz"IsolatedAsyncioTestCase._callSetUpcCs|�|�dSr��_callMaybeAsync)r�methodrrr�_callTestMethod@sz'IsolatedAsyncioTestCase._callTestMethodcCs|�|j�|��dSr)rrZtearDownrrrr�
_callTearDownCsz%IsolatedAsyncioTestCase._callTearDowncOs|j|f|�|�dSrr)rZfunctionrrrrr�_callCleanupGsz$IsolatedAsyncioTestCase._callCleanupcOsL|jdk	st�|||�}t�|�s&t�|j��}|j�||f�|j�|�Sr�r	�AssertionError�inspectZisawaitable�
create_futurer
�
put_nowait�run_until_complete�rrrr�ret�futrrrrJs

z"IsolatedAsyncioTestCase._callAsynccOsP|jdk	st�|||�}t�|�rH|j��}|j�||f�|j�|�S|SdSrrr%rrrrRs


z'IsolatedAsyncioTestCase._callMaybeAsyncc
�s�t��|_}|�d�|��IdH}|��|dkr:dS|\}}z |IdH}|��s`|�|�Wqttfk
r|�Yqt	tj
fk
r�}z|��s�|�|�W5d}~XYqXqdSr)�asyncioZQueuer
Z
set_result�getZ	task_done�	cancelled�
SystemExit�KeyboardInterrupt�
BaseExceptionZCancelledErrorZ
set_exception)rr'ZqueueZqueryZ	awaitabler&Zexrrr�_asyncioLoopRunner\s 

z*IsolatedAsyncioTestCase._asyncioLoopRunnercCsX|jdkst�t��}t�|�|�d�||_|��}|�|�|��|_	|�
|�dS)NT)r	r r(Znew_event_loop�set_event_loopZ	set_debugr"Zcreate_taskr.Z_asyncioCallsTaskr$)r�loopr'rrr�_setupAsyncioLoopos

z)IsolatedAsyncioTestCase._setupAsyncioLoopc	Cs�|jdk	st�|j}d|_|j�d�|�|j���z�t�	|�}|sNW�vdS|D]}|�
�qR|�tj||dd���|D]0}|��r�q||�
�dk	r||�d|�
�|d��q||�|���W5t�d�|��XdS)NT)r0Zreturn_exceptionsz(unhandled exception during test shutdown)�message�	exception�task)r	r r
r#r$�joinr(r/�closeZ	all_tasksZcancelZgatherr*r3Zcall_exception_handlerZshutdown_asyncgens)rr0Z	to_cancelr4rrr�_tearDownAsyncioLoopys4

��

z,IsolatedAsyncioTestCase._tearDownAsyncioLoopNcs(|��zt��|�W�S|��XdSr)r1r7r�run)r�resultrrrr8�szIsolatedAsyncioTestCase.run)r)N)�__name__�
__module__�__qualname__rrrrrrrrrrr.r1r7r8�
__classcell__rrrrrs

"r)r(r!Zcaserrrrrr�<module>s