JFIFxxC      C  " }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3RbrJFIFxxC      C  " }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbra XC?h@s0ddlZddlZddlmZGdddeZdS)N)TestCasecseZdZd#fdd ZddZddZdd Zd d Zd d ZddZ ddZ ddZ ddZ ddZ ddZddZd$fdd Zfdd Zd!d"ZZS)%IsolatedAsyncioTestCaserunTestcst|d|_d|_dSN)super__init___asyncioTestLoop_asyncioCallsQueue)selfZ methodName __class__8/opt/alt/python39/lib64/python3.9/unittest/async_case.pyr!s z IsolatedAsyncioTestCase.__init__csdSrrr rrr asyncSetUp&sz"IsolatedAsyncioTestCase.asyncSetUpcsdSrrrrrr asyncTearDown)sz%IsolatedAsyncioTestCase.asyncTearDowncOs|j|g|Ri|dSr)Z addCleanup)r funcargskwargsrrraddAsyncCleanup,s z'IsolatedAsyncioTestCase.addAsyncCleanupcCs|||jdSr)ZsetUp _callAsyncrrrrr _callSetUp;sz"IsolatedAsyncioTestCase._callSetUpcCs||dSr_callMaybeAsync)r methodrrr_callTestMethod?sz'IsolatedAsyncioTestCase._callTestMethodcCs||j|dSr)rrZtearDownrrrr _callTearDownBs z%IsolatedAsyncioTestCase._callTearDowncOs|j|g|Ri|dSrr)r Zfunctionrrrrr _callCleanupFsz$IsolatedAsyncioTestCase._callCleanupcOs^|jdusJd||i|}t|s8J|d|j}|j||f|j|S)N$asyncio test loop is not initializedz returned non-awaitabler inspectZ isawaitable create_futurer put_nowaitrun_until_completer rrrretfutrrrrIs  z"IsolatedAsyncioTestCase._callAsynccOsX|jdusJd||i|}t|rP|j}|j||f|j|S|SdS)Nrr r%rrrrQs   z'IsolatedAsyncioTestCase._callMaybeAsyncc st|_}|d|IdH}||dur:dS|\}}z |IdH}|s`||WqttfyzYqt tj fy}z|s| |WYd}~qd}~00qdSr) asyncioZQueuer Z set_resultgetZ task_done cancelled SystemExitKeyboardInterrupt BaseExceptionZCancelledErrorZ set_exception)r r'ZqueueZqueryZ awaitabler&Zexrrr_asyncioLoopRunner[s   z*IsolatedAsyncioTestCase._asyncioLoopRunnercCs\|jdusJdt}t||d||_|}||||_| |dS)Nz%asyncio test loop already initializedT) r r(Znew_event_loopset_event_loopZ set_debugr"Z create_taskr.Z_asyncioCallsTaskr$)r loopr'rrr_setupAsyncioLoopns  z)IsolatedAsyncioTestCase._setupAsyncioLoopc Cs&|jdusJd|j}d|_|jd||jzt|}|spW||td| dS|D] }| qt|tj |ddi|D]0}| rq| dur|d| |dq||W||td| n"||td| 0dS)NrZreturn_exceptionsTz(unhandled exception during test shutdown)message exceptiontask)r r r#r$joinr(Z all_tasksZshutdown_default_executorr/closeZcancelZgatherr*r3Zcall_exception_handlerZshutdown_asyncgens)r r0Z to_cancelr4rrr_tearDownAsyncioLoopxsD         z,IsolatedAsyncioTestCase._tearDownAsyncioLoopNcs.|zt|W|S|0dSr)r1rrunr7)r resultr rrr8s  zIsolatedAsyncioTestCase.runcs|t|dSr)r1rdebugr7rr rrr:s zIsolatedAsyncioTestCase.debugcCs|jdur|dSr)r r7rrrr__del__s zIsolatedAsyncioTestCase.__del__)r)N)__name__ __module__ __qualname__rrrrrrrrrrr.r1r7r8r:r; __classcell__rrr rrs   $ r)r(r!Zcaserrrrrrs