Your IP : 18.227.72.27


Current Path : /opt/alt/python39/lib64/python3.9/unittest/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/unittest/__pycache__/suite.cpython-39.opt-2.pyc

a

R�f�4�@sxddlZddlmZddlmZdZdd�ZGdd	�d	e�ZGd
d�de�ZGdd
�d
e�Z	dd�Z
Gdd�de�ZdS)�N�)�case)�utilTcCst||dd��}|�dS)NcSsdS�N�rrr�3/opt/alt/python39/lib64/python3.9/unittest/suite.py�<lambda>�z!_call_if_exists.<locals>.<lambda>)�getattr)�parent�attr�funcrrr�_call_if_existssrc@sjeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)�
BaseTestSuiteTrcCsg|_d|_|�|�dS�Nr)�_tests�_removed_tests�addTests)�self�testsrrr�__init__szBaseTestSuite.__init__cCsdt�|j�t|�fS)Nz
<%s tests=%s>)r�strclass�	__class__�list�rrrr�__repr__szBaseTestSuite.__repr__cCs t||j�stSt|�t|�kSr)�
isinstancer�NotImplementedr)r�otherrrr�__eq__szBaseTestSuite.__eq__cCs
t|j�Sr)�iterrrrrr�__iter__"szBaseTestSuite.__iter__cCs$|j}|D]}|r
||��7}q
|Sr)r�countTestCases)rZcases�testrrrr"%s
zBaseTestSuite.countTestCasescCsLt|�std�t|����t|t�r<t|tjt	f�r<td��|j
�|�dS)Nz{} is not callablezNTestCases and TestSuites must be instantiated before passing them to addTest())�callable�	TypeError�format�reprr�type�
issubclassrZTestCase�	TestSuiter�append�rr#rrr�addTest,s�zBaseTestSuite.addTestcCs*t|t�rtd��|D]}|�|�qdS)Nz0tests must be an iterable of tests, not a string)r�strr%r-)rrr#rrrr6s
zBaseTestSuite.addTestscCs8t|�D]*\}}|jrq4||�|jr|�|�q|Sr)�	enumerate�
shouldStop�_cleanup�_removeTestAtIndex)r�result�indexr#rrr�run<szBaseTestSuite.runcCsLz|j|}Wnty Yn(0t|d�r>|j|��7_d|j|<dS)Nr")rr%�hasattrrr")rr4r#rrrr2Es
z BaseTestSuite._removeTestAtIndexcOs|j|i|��Sr�r5)r�args�kwdsrrr�__call__SszBaseTestSuite.__call__cCs|D]}|��qdSr)�debugr,rrrr;VszBaseTestSuite.debugN)r)�__name__�
__module__�__qualname__r1rrrr!r"r-rr5r2r:r;rrrrrs

	rc@sZeZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
d�Zddd�Z	dd�Z
dd�ZdS)r*FcCs�d}t|dd�durd|_}t|�D]�\}}|jr8q�t|�r�|�||�|�||�|�||�|j|_	t|jdd�s&t|dd�r�q&|s�||�n|�
�|jr&|�|�q&|r�|�d|�|�
|�d|_|S)NF�_testRunEnteredT�_classSetupFailed�_moduleSetUpFailed)r
r?r/r0�_isnotsuite�_tearDownPreviousClass�_handleModuleFixture�_handleClassSetUpr�_previousTestClassr;r1r2�_handleModuleTearDown)rr3r;ZtopLevelr4r#rrrr5fs2

�

z
TestSuite.runcCst�}|�|d�dS)NT)�_DebugResultr5)rr;rrrr;�szTestSuite.debugcCsZt|dd�}|j}||krdS|jr(dSt|dd�r8dSd}z
d|_WntyXYn0t|dd�}t|dd�}|du�rVt|d�z�z
|�Wnlty�}zTt|t�r��d}z
d|_Wnty�Yn0t	�
|�}	|�||d|	�WYd}~n
d}~00|�r<|du�r<|�|jD]}
|j||
dd|	|
d	��qWt|d
�nt|d
�0dS)NrF�__unittest_skip__F�
setUpClass�doClassCleanups�_setupStdoutTr��info�_restoreStdout)
r
rrAr@r%r�	ExceptionrrHrr�"_createClassOrModuleLevelException�tearDown_exceptions)rr#r3�
previousClass�currentClassZfailedrJrK�e�	className�exc_inforrrrE�sR






�
�zTestSuite._handleClassSetUpcCs"d}t|dd�}|dur|j}|S)NrF)r
r=)rr3�previousModulerSrrr�_get_previous_module�s
zTestSuite._get_previous_modulec
Cs0|�|�}|jj}||krdS|�|�d|_ztj|}WntyPYdS0t|dd�}|du�r,t	|d�z�z
|�WnFt
y�}z.t|t�r��d|_|�
||d|�WYd}~n
d}~00|j�rzt��Wn6t
�y}z|�
||d|�WYd}~n
d}~00Wt	|d�nt	|d�0dS)NF�setUpModulerLTrO)rYrr=rGrA�sys�modules�KeyErrorr
rrPrrHrQr�doModuleCleanups)rr#r3rXZ
currentModule�modulerZrUrrrrD�sB





��zTestSuite._handleModuleFixtureNcCs$|�d|�d�}|�||||�dS)Nz (�))�_addClassOrModuleLevelException)rr3�excZmethod_namerrN�	errorNamerrrrQ�sz,TestSuite._createClassOrModuleLevelExceptioncCs^t|�}t|dd�}|dur8t|tj�r8||t|��n"|sN|�|t���n|�||�dS)N�addSkip)	�_ErrorHolderr
rrZSkipTestr.ZaddErrorr[rW)rr3Z	exceptionrcrN�errorrdrrrra�sz)TestSuite._addClassOrModuleLevelExceptionc
Cs|�|�}|durdS|jr dSztj|}WntyBYdS0t|d�z�t|dd�}|dur�z
|�Wn@ty�}z(t|t	�r��|�
||d|�WYd}~n
d}~00zt��WnBt�y�}z(t|t	�rڂ|�
||d|�WYd}~n
d}~00Wt|d�nt|d�0dS)NrL�tearDownModulerO)
rYrAr[r\r]rr
rPrrHrQrr^)rr3rXr_rgrUrrrrG�s@



�
�zTestSuite._handleModuleTearDownc

Cs^t|dd�}|j}||ks"|dur&dSt|dd�r6dSt|dd�rFdSt|dd�rVdSt|dd�}t|dd�}|dur�|dur�dSt|d�z�|dur�z
|�WnJty�}z2t|t�r��t�|�}|�||d|�WYd}~n
d}~00|du�r@|�|j	D]<}	t|t��r|	d	�t�|�}|j||	d	d||	d
��qWt|d�nt|d�0dS)NrFr@FrArI�
tearDownClassrKrLrrMrO)
r
rrrPrrHrrrQrR)
rr#r3rSrTrhrKrUrVrWrrrrCsN



�


�z TestSuite._tearDownPreviousClass)F)N)N)r<r=r>r5r;rErYrDrQrarGrCrrrrr*\s

!.&�
�
#r*c@sPeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�ZdS)reNcCs
||_dSr��description)rrjrrrrTsz_ErrorHolder.__init__cCs|jSrrirrrr�idWsz_ErrorHolder.idcCsdSrrrrrr�shortDescriptionZsz_ErrorHolder.shortDescriptioncCsd|jfS)Nz<ErrorHolder description=%r>rirrrrr]sz_ErrorHolder.__repr__cCs|��Sr)rkrrrr�__str__`sz_ErrorHolder.__str__cCsdSrr�rr3rrrr5csz_ErrorHolder.runcCs
|�|�Srr7rnrrrr:hsz_ErrorHolder.__call__cCsdSrrrrrrr"ksz_ErrorHolder.countTestCases)r<r=r>ZfailureExceptionrrkrlrrmr5r:r"rrrrreHs
recCs&zt|�Wnty YdS0dS)NTF)r r%)r#rrrrBns
rBc@seZdZdZdZdZdS)rHNF)r<r=r>rFrAr0rrrrrHwsrH)r[�rrZ
__unittestr�objectrr*rerBrHrrrr�<module>sLm&	

?>