a  zeÐã@sTddlZddlZddlZdd„ZGdd„dƒZGdd„dejƒZedkrPe ¡dS) éNcCst d¡dS©N)ÚasyncioZset_event_loop_policy©rrúZ/opt/bitninja-python-dojo/embedded/lib/python3.9/test/test_asyncio/test_asyncio_waitfor.pyÚtearDownModulesrc@s$eZdZdZdZdd„Zdd„ZdS)ÚSlowTaskz? Task will run for this defined time, ignoring cancel requests gš™™™™™É?cCs d|_dS)NF)Úexited©ÚselfrrrÚ__init__ szSlowTask.__init__cÃsZt ¡|j}|t ¡}|dkr$qPzt |¡IdHWqtjyLYq0qd|_dS)NrT)ÚtimeÚ monotonicÚ TASK_TIMEOUTrÚsleepÚCancelledErrorr)r ZexitatZtosleeprrrÚruns z SlowTask.runN)Ú__name__Ú __module__Ú __qualname__Ú__doc__rr rrrrrr src@s,eZdZdd„Zdd„Zdd„Zdd„Zd S) ÚAsyncioWaitForTestcÃs\tƒ}t t | ¡|jd¡¡}t d¡IdH| ¡t |h¡IdH|  |j ¡dS)Nér) rrZ create_taskÚwait_forrrrÚcancelÚwaitÚ assertTruer)r ÚtZ waitfortaskrrrÚ atest_asyncio_wait_for_cancelled!s z3AsyncioWaitForTest.atest_asyncio_wait_for_cancelledcCst | ¡¡dSr)rrrr rrrÚtest_asyncio_wait_for_cancelled+sz2AsyncioWaitForTest.test_asyncio_wait_for_cancelledcÃsLtƒ}z t | ¡|jd¡IdHWntjy:Yn0| |j¡dS)Nr)rrrrrÚ TimeoutErrorrr)r rrrrÚatest_asyncio_wait_for_timeout.s  z1AsyncioWaitForTest.atest_asyncio_wait_for_timeoutcCst | ¡¡dSr)rrr r rrrÚtest_asyncio_wait_for_timeout8sz0AsyncioWaitForTest.test_asyncio_wait_for_timeoutN)rrrrrr r!rrrrrs  rÚ__main__) rZunittestr rrZTestCaserrÚmainrrrrÚs