관리-도구
편집 파일: async_case.cpython-39.opt-1.pyc
a �����DOg�����������������������@���s0���d�dl�Z�d�dlZddlmZ�G�dd��de�ZdS�)�����N����)�TestCasec�����������������������s����e�Zd�Zd#��fdd� Zdd��Zdd��Zdd ��Zd d��Zdd ��Zdd��Z dd��Z dd��Zdd��Zdd��Z dd��Zdd��Zd$��fdd� Z��fdd �Zd!d"��Z���ZS�)%�IsolatedAsyncioTestCase�runTestc��������������������s���t����|��d�|�_d�|�_d�S��N)�super�__init__�_asyncioTestLoop�_asyncioCallsQueue)�selfZ methodName�� __class__���+/usr/lib64/python3.9/unittest/async_case.pyr���!���s����z IsolatedAsyncioTestCase.__init__c���������������������s���d�S�r���r����r���r���r���r���� asyncSetUp&���s����z"IsolatedAsyncioTestCase.asyncSetUpc���������������������s���d�S�r���r���r���r���r���r���� asyncTearDown)���s����z%IsolatedAsyncioTestCase.asyncTearDownc����������������O���s���|�j�|g|�R�i�|���d�S�r���)Z addCleanup)r����func�args�kwargsr���r���r����addAsyncCleanup,���s���� z'IsolatedAsyncioTestCase.addAsyncCleanupc�����������������C���s���|������|��|�j��d�S�r���)ZsetUp� _callAsyncr���r���r���r���r���� _callSetUp;���s����z"IsolatedAsyncioTestCase._callSetUpc�����������������C���s���|���|��d�S�r�����_callMaybeAsync)r����methodr���r���r����_callTestMethod?���s����z'IsolatedAsyncioTestCase._callTestMethodc�����������������C���s���|���|�j��|�����d�S�r���)r���r���ZtearDownr���r���r���r���� _callTearDownB���s����z%IsolatedAsyncioTestCase._callTearDownc�����������������O���s���|�j�|g|�R�i�|���d�S�r���r���)r����functionr���r���r���r���r����_callCleanupF���s����z$IsolatedAsyncioTestCase._callCleanupc����������������O���s4���||i�|��}|�j����}|�j�||f��|�j��|�S�r���)r ���� create_futurer ���� put_nowait�run_until_complete�r���r���r���r����ret�futr���r���r���r���I���s���� z"IsolatedAsyncioTestCase._callAsyncc����������������O���sF���||i�|��}t��|�r>|�j���}|�j�||f��|�j�|�S�|S�d�S�r���)�inspectZisawaitabler ���r ���r ���r!���r"���r#���r���r���r���r���Q���s���� z'IsolatedAsyncioTestCase._callMaybeAsyncc�������������� �������s����t�����|�_}|�d���|���I�d�H�}|����|d�u�r:d�S�|\}}z |I�d�H�}|���s`|�|��W�q�ttfyz�����Y�q�t t�j fy��}�z|���s�|�|��W�Y�d�}~qd�}~0�0�qd�S�r���)�asyncio�Queuer ���� set_result�get� task_done� cancelled� SystemExit�KeyboardInterrupt� BaseException�CancelledError� set_exception)r���r%����queue�queryZ awaitabler$����exr���r���r����_asyncioLoopRunner[���s ���� z*IsolatedAsyncioTestCase._asyncioLoopRunnerc�����������������C���sJ���t����}t��|��|�d��||�_|���}|�|��|��|�_|� |��d�S�)NT) r'���Znew_event_loop�set_event_loopZ set_debugr ���r ���Zcreate_taskr5���Z_asyncioCallsTaskr"���)r����loopr%���r���r���r����_setupAsyncioLoopn���s���� z)IsolatedAsyncioTestCase._setupAsyncioLoopc�������������� ���C���s��|�j�}d�|�_�|�j�d���|�|�j�����z�t�|�}|s^W�|�|�����t�d���|� ���d�S�|D�]}|� ���qb|�tj|ddi���|D�]0}|���r�q�|� ��d�ur�|�d|� ��|d���q�|�|�����W�|�|�����t�d���|� ���n"|�|�����t�d���|� ���0�d�S�)NZreturn_exceptionsTz(unhandled exception during test shutdown)�message� exception�task)r ���r ���r!���r"����joinr'���Z all_tasksZshutdown_default_executorr6����close�cancelZgatherr,���r:���Zcall_exception_handlerZshutdown_asyncgens)r���r7���Z to_cancelr;���r���r���r����_tearDownAsyncioLoopx���sB���� � �� � z,IsolatedAsyncioTestCase._tearDownAsyncioLoopNc��������������������s.���|������zt���|�W�|�����S�|�����0�d�S�r���)r8���r����runr?���)r����resultr���r���r���r@�������s�����zIsolatedAsyncioTestCase.runc��������������������s���|������t������|�����d�S�r���)r8���r����debugr?���r���r���r���r���rB�������s���� zIsolatedAsyncioTestCase.debugc�����������������C���s���|�j�d�ur|�����d�S�r���)r ���r?���r���r���r���r����__del__����s���� zIsolatedAsyncioTestCase.__del__)r���)N)�__name__� __module__�__qualname__r���r���r���r���r���r���r���r���r���r���r5���r8���r?���r@���rB���rC���� __classcell__r���r���r���r���r������s ��� $r���)r'���r&���Zcaser���r���r���r���r���r����<module>���s���