Your IP : 216.73.216.213


Current Path : /opt/alt/python39/lib64/python3.9/unittest/test/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/unittest/test/__pycache__/test_async_case.cpython-39.opt-1.pyc

a

XC?h�'�@sZddlZddlZddlmZGdd�de�Zdd�ZGdd�dej�Ze	d	krVe�
�dS)
�N)�supportc@seZdZdS)�MyExceptionN)�__name__�
__module__�__qualname__�rr�B/opt/alt/python39/lib64/python3.9/unittest/test/test_async_case.pyrsrcCst�d�dS�N)�asyncioZset_event_loop_policyrrrr�tearDownModule
src@sXeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�ZdS)�
TestAsyncCaseNcCst��dSr	)rZ
gc_collect��selfrrr�tearDownszTestAsyncCase.tearDowncs�G�fdd�dtj�}g�|d�}|��}|�|jg�|�|jg�gd�}|��|�g�|d�}|��|��|�|��|��|�dS)Ncs`eZdZ�fdd�Z�fdd�Z�fdd�Z�fdd�Z�fd	d
�Z�fdd�Z�fd
d�Z	dS)z+TestAsyncCase.test_full_cycle.<locals>.Testcs|��g���d�dS)N�setUp��assertEqual�appendr
�Zeventsrrrsz1TestAsyncCase.test_full_cycle.<locals>.Test.setUpc�s(|��dg���d�|�|j�dS)Nr�
asyncSetUp)rr�addAsyncCleanup�on_cleanup1r
rrrrs
z6TestAsyncCase.test_full_cycle.<locals>.Test.asyncSetUpc�s*|��ddg���d�|�|j�dS)Nrr�test)rrr�on_cleanup2r
rrr�	test_func!s
�
z5TestAsyncCase.test_full_cycle.<locals>.Test.test_funcc�s|��gd����d�dS)N)rrr�
asyncTearDownrr
rrrr'sz9TestAsyncCase.test_full_cycle.<locals>.Test.asyncTearDowncs|��gd����d�dS)N)rrrrrrr
rrrr-sz4TestAsyncCase.test_full_cycle.<locals>.Test.tearDownc�s|��gd����d�dS)N)rrrrr�cleanup2�cleanup1rr
rrrr4sz7TestAsyncCase.test_full_cycle.<locals>.Test.on_cleanup1c�s|��gd����d�dS)N)rrrrrrrr
rrrr=sz7TestAsyncCase.test_full_cycle.<locals>.Test.on_cleanup2N)
rrrrrrrrrrrrrr�Tests	rr)rrrrrrr)�unittest�IsolatedAsyncioTestCase�runr�errorsZfailures�debug�
doCleanups)rrr�resultZexpectedrrr�test_full_cycles.zTestAsyncCase.test_full_cyclecs�G�fdd�dtj�}g�|d�}|��}|��ddg�|�|jdd|�|�d|jdd�g�|d�}z|��Wnty�Yn0|�	d	�|��dg�|�
�|��ddg�dS)
Ncs<eZdZ�fdd�Z�fdd�Z�fdd�Z�fdd�Zd	S)
z3TestAsyncCase.test_exception_in_setup.<locals>.Testc�s ��d�|�|j�t��dS�Nr�rr�
on_cleanuprr
rrrrWs
z>TestAsyncCase.test_exception_in_setup.<locals>.Test.asyncSetUpc�s��d�dS�Nr�rr
rrrr\sz=TestAsyncCase.test_exception_in_setup.<locals>.Test.test_funcc�s��d�dS�Nrr+r
rrrr_szATestAsyncCase.test_exception_in_setup.<locals>.Test.asyncTearDownc�s��d�dS�N�cleanupr+r
rrrr)bsz>TestAsyncCase.test_exception_in_setup.<locals>.Test.on_cleanupN�rrrrrrr)rrrrrVsrrrr.rr�� Expected a MyException exception�rr r!rZassertIsr"ZassertInr#rZfailr$�rrrr%rrr�test_exception_in_setupUs"
z%TestAsyncCase.test_exception_in_setupcs�G�fdd�dtj�}g�|d�}|��}|��gd��|�|jdd|�|�d|jdd�g�|d�}z|��Wnty�Yn0|�	d�|��d	d
g�|�
�|��gd��dS)Ncs<eZdZ�fdd�Z�fdd�Z�fdd�Z�fdd�Zd	S)
z2TestAsyncCase.test_exception_in_test.<locals>.Testc�s��d�dSr'r+r
rrrr{sz=TestAsyncCase.test_exception_in_test.<locals>.Test.asyncSetUpc�s ��d�|�|j�t��dSr*r(r
rrrr~s
z<TestAsyncCase.test_exception_in_test.<locals>.Test.test_funcc�s��d�dSr,r+r
rrrr�sz@TestAsyncCase.test_exception_in_test.<locals>.Test.asyncTearDownc�s��d�dSr-r+r
rrrr)�sz=TestAsyncCase.test_exception_in_test.<locals>.Test.on_cleanupNr/rrrrrzsrr�rrrr.rrr0r1rr)rrr.r2r3rrr�test_exception_in_testys"
z$TestAsyncCase.test_exception_in_testcs�G�fdd�dtj�}g�|d�}|��}|��gd��|�|jdd|�|�d|jdd�g�|d�}z|��Wnty�Yn0|�	d�|��gd	��|�
�|��gd��dS)
Ncs<eZdZ�fdd�Z�fdd�Z�fdd�Z�fdd�Zd	S)
z7TestAsyncCase.test_exception_in_tear_down.<locals>.Testc�s��d�dSr'r+r
rrrr�szBTestAsyncCase.test_exception_in_tear_down.<locals>.Test.asyncSetUpc�s��d�|�|j�dSr*)rrr)r
rrrr�s
zATestAsyncCase.test_exception_in_tear_down.<locals>.Test.test_funcc�s��d�t��dSr,�rrr
rrrr�s
zETestAsyncCase.test_exception_in_tear_down.<locals>.Test.asyncTearDownc�s��d�dSr-r+r
rrrr)�szBTestAsyncCase.test_exception_in_tear_down.<locals>.Test.on_cleanupNr/rrrrr�srrr5rrr0r1)rrrr2r3rrr�test_exception_in_tear_down�s"
z)TestAsyncCase.test_exception_in_tear_downcs�G�fdd�dtj�}g�|d�}|��}|��gd��|�|jdd|�|�d|jdd�|�d|jdd�g�|d�}z|��Wnty�Yn0|�	d	�|��gd
��|�
�|��gd��dS)NcsHeZdZ�fdd�Z�fdd�Z�fdd�Z�fdd�Z�fd	d
�ZdS)z;TestAsyncCase.test_exception_in_tear_clean_up.<locals>.Testc�s��d�dSr'r+r
rrrr�szFTestAsyncCase.test_exception_in_tear_clean_up.<locals>.Test.asyncSetUpc�s&��d�|�|j�|�|j�dSr*)rrrrr
rrrr�s
zETestAsyncCase.test_exception_in_tear_clean_up.<locals>.Test.test_funcc�s��d�dSr,r+r
rrrr�szITestAsyncCase.test_exception_in_tear_clean_up.<locals>.Test.asyncTearDownc�s��d�td��dS)Nrz
some errorr7r
rrrr�s
zGTestAsyncCase.test_exception_in_tear_clean_up.<locals>.Test.on_cleanup1c�s��d�td��dS)Nrzother errorr7r
rrrr�s
zGTestAsyncCase.test_exception_in_tear_clean_up.<locals>.Test.on_cleanup2N)rrrrrrrrrrrrr�s
rr)rrrrrrzMyException: other errorr0zMyException: some errorr1)rrrrr2r3rrr�test_exception_in_tear_clean_up�s$
z-TestAsyncCase.test_exception_in_tear_clean_upcs>g�G�fdd�dtj�}|d�}|��|��gd��dS)Ncs,eZdZdd�Z�fdd�Z�fdd�ZdS)z:TestAsyncCase.test_cleanups_interleave_order.<locals>.Testc�s<|�|jd�|�|jd�|�|jd�|�|jd�dS)Nr0���)r�on_sync_cleanup�on_async_cleanupr
rrrr�szDTestAsyncCase.test_cleanups_interleave_order.<locals>.Test.test_funcc�s��d|���dS)Nz
sync_cleanup r+�r�valrrrr=�szJTestAsyncCase.test_cleanups_interleave_order.<locals>.Test.on_sync_cleanupc�s��d|���dS)Nzasync_cleanup r+r?rrrr>�szKTestAsyncCase.test_cleanups_interleave_order.<locals>.Test.on_async_cleanupN)rrrrr=r>rrrrr�srr)zasync_cleanup 4zsync_cleanup 3zasync_cleanup 2zsync_cleanup 1)rr r!r)rrrrrr�test_cleanups_interleave_order�s

z,TestAsyncCase.test_cleanups_interleave_ordercszg�G�fdd�dtj�}|d�}|��}|�|���|d�}|��|��ddg�|d�}|��}|�|���dS)Ncs,eZdZ�fdd�Z�fdd�Zdd�ZdS)zATestAsyncCase.test_base_exception_from_async_method.<locals>.Testc�s��d�t����d�dS)N�	test_baseznot it)r�
BaseExceptionr
rrrrBs
zKTestAsyncCase.test_base_exception_from_async_method.<locals>.Test.test_basec�s��d�dS)N�test_no_errr+r
rrrrDszMTestAsyncCase.test_base_exception_from_async_method.<locals>.Test.test_no_errc�st���dSr	)r
�CancelledErrorr
rrr�test_cancel
szMTestAsyncCase.test_base_exception_from_async_method.<locals>.Test.test_cancelN)rrrrBrDrFrrrrrsrrBrDrF)rr r!ZassertFalseZ
wasSuccessfulr�rrr�outputrrr�%test_base_exception_from_async_method�sz3TestAsyncCase.test_base_exception_from_async_methodcs8d�G�fdd�dtj�}|d�}|��}|���dS)NFcseZdZ�fdd�ZdS)z;TestAsyncCase.test_cancellation_hanging_tasks.<locals>.Testc�s�fdd�}t�|��dS)Nc�s4zt�d�IdHWntjy.d��Yn0dS)Nr0T)r
�sleeprEr�Z	cancelledrr�coros
z[TestAsyncCase.test_cancellation_hanging_tasks.<locals>.Test.test_leaking_task.<locals>.coro)r
Zcreate_task)rrLrKrr�test_leaking_tasks	zMTestAsyncCase.test_cancellation_hanging_tasks.<locals>.Test.test_leaking_taskN)rrrrMrrKrrrsrrM)rr r!Z
assertTruerGrrKr�test_cancellation_hanging_taskss

z-TestAsyncCase.test_cancellation_hanging_tasks)
rrrZmaxDiffrr&r4r6r8r9rArIrNrrrrrs?$##)r�__main__)r
rrr�	ExceptionrrZTestCaserr�mainrrrr�<module>s"