Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.9/unittest/test/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.9/unittest/test/__pycache__/test_async_case.cpython-39.pyc

a

��g�'�@sZddlZddlZddlmZGdd�de�Zdd�ZGdd�dej�Ze	d	krVe�
�dS)
�N)�supportc@seZdZdS)�MyExceptionN)�__name__�
__module__�__qualname__�rr�9/usr/local/lib/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	)r�
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��eventsrrrsz1TestAsyncCase.test_full_cycle.<locals>.Test.setUpc�s(|��dg���d�|�|j�dS)Nr�
asyncSetUp)rr�addAsyncCleanup�on_cleanup1rrrrrs
z6TestAsyncCase.test_full_cycle.<locals>.Test.asyncSetUpc�s*|��ddg���d�|�|j�dS)Nrr�test)rrr�on_cleanup2rrrr�	test_func!s
�
z5TestAsyncCase.test_full_cycle.<locals>.Test.test_funcc�s|��gd����d�dS)N)rrr�
asyncTearDownrrrrrr'sz9TestAsyncCase.test_full_cycle.<locals>.Test.asyncTearDowncs|��gd����d�dS)N)rrrrrrrrrrr-sz4TestAsyncCase.test_full_cycle.<locals>.Test.tearDownc�s|��gd����d�dS)N)rrrrr�cleanup2�cleanup1rrrrrr4sz7TestAsyncCase.test_full_cycle.<locals>.Test.on_cleanup1c�s|��gd����d�dS)N)rrrrrrrrrrrr=sz7TestAsyncCase.test_full_cycle.<locals>.Test.on_cleanup2N)
rrrrrrrrrrrrrr�Tests	r r)rrrrrrr)�unittest�IsolatedAsyncioTestCase�runr�errorsZfailures�debug�
doCleanups)rr r�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_cleanuprrrrrrWs
z>TestAsyncCase.test_exception_in_setup.<locals>.Test.asyncSetUpc�s��d�dS�Nr�rrrrrr\sz=TestAsyncCase.test_exception_in_setup.<locals>.Test.test_funcc�s��d�dS�Nrr-rrrrr_szATestAsyncCase.test_exception_in_setup.<locals>.Test.asyncTearDownc�s��d�dS�N�cleanupr-rrrrr+bsz>TestAsyncCase.test_exception_in_setup.<locals>.Test.on_cleanupN�rrrrrrr+rrrrr Vsr rrr0rr�� Expected a MyException exception�r!r"r#rZassertIsr$ZassertInr%rZfailr&�rr rr'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-rrrrr{sz=TestAsyncCase.test_exception_in_test.<locals>.Test.asyncSetUpc�s ��d�|�|j�t��dSr,r*rrrrr~s
z<TestAsyncCase.test_exception_in_test.<locals>.Test.test_funcc�s��d�dSr.r-rrrrr�sz@TestAsyncCase.test_exception_in_test.<locals>.Test.asyncTearDownc�s��d�dSr/r-rrrrr+�sz=TestAsyncCase.test_exception_in_test.<locals>.Test.on_cleanupNr1rrrrr zsr r�rrrr0rrr2r3rr)rrr0r4r5rrr�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-rrrrr�szBTestAsyncCase.test_exception_in_tear_down.<locals>.Test.asyncSetUpc�s��d�|�|j�dSr,)rrr+rrrrr�s
zATestAsyncCase.test_exception_in_tear_down.<locals>.Test.test_funcc�s��d�t��dSr.�rrrrrrr�s
zETestAsyncCase.test_exception_in_tear_down.<locals>.Test.asyncTearDownc�s��d�dSr/r-rrrrr+�szBTestAsyncCase.test_exception_in_tear_down.<locals>.Test.on_cleanupNr1rrrrr �sr rr7rrr2r3)rrrr4r5rrr�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-rrrrr�szFTestAsyncCase.test_exception_in_tear_clean_up.<locals>.Test.asyncSetUpc�s&��d�|�|j�|�|j�dSr,)rrrrrrrrr�s
zETestAsyncCase.test_exception_in_tear_clean_up.<locals>.Test.test_funcc�s��d�dSr.r-rrrrr�szITestAsyncCase.test_exception_in_tear_clean_up.<locals>.Test.asyncTearDownc�s��d�td��dS)Nrz
some errorr9rrrrr�s
zGTestAsyncCase.test_exception_in_tear_clean_up.<locals>.Test.on_cleanup1c�s��d�td��dS)Nrzother errorr9rrrrr�s
zGTestAsyncCase.test_exception_in_tear_clean_up.<locals>.Test.on_cleanup2N)rrrrrrrrrrrrr �s
r r)rrrrrrzMyException: other errorr2zMyException: some errorr3)rrrrr4r5rrr�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)Nr2���)r�on_sync_cleanup�on_async_cleanuprrrrr�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-rArrrr@�szKTestAsyncCase.test_cleanups_interleave_order.<locals>.Test.on_async_cleanupN)rrrrr?r@rrrrr �sr r)zasync_cleanup 4zsync_cleanup 3zasync_cleanup 2zsync_cleanup 1)r!r"r#r)rr rrrr�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�
BaseExceptionrrrrrDs
zKTestAsyncCase.test_base_exception_from_async_method.<locals>.Test.test_basec�s��d�dS)N�test_no_errr-rrrrrFszMTestAsyncCase.test_base_exception_from_async_method.<locals>.Test.test_no_errc�st���dSr	)r
�CancelledErrorrrrr�test_cancel
szMTestAsyncCase.test_base_exception_from_async_method.<locals>.Test.test_cancelN)rrrrDrFrHrrrrr sr rDrFrH)r!r"r#ZassertFalseZ
wasSuccessfulr�rr r�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)Nr2T)r
�sleeprGr��	cancelledrr�coros
z[TestAsyncCase.test_cancellation_hanging_tasks.<locals>.Test.test_leaking_task.<locals>.coro)r
Zcreate_task)rrOrMrr�test_leaking_tasks	zMTestAsyncCase.test_cancellation_hanging_tasks.<locals>.Test.test_leaking_taskN)rrrrPrrMrrr sr rP)r!r"r#Z
assertTruerIrrMr�test_cancellation_hanging_taskss

z-TestAsyncCase.test_cancellation_hanging_tasks)
rrrZmaxDiffrr(r6r8r:r;rCrKrQrrrrrs?$##)r�__main__)r
r!rr�	ExceptionrrZTestCaserr�mainrrrr�<module>s"

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists