Your IP : 3.145.166.223


Current Path : /usr/lib64/python3.8/unittest/__pycache__/
Upload File :
Current File : //usr/lib64/python3.8/unittest/__pycache__/suite.cpython-38.opt-2.pyc

U

e5d2�@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�&/usr/lib64/python3.8/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.runcCsNz|j|}Wntk
r"Yn(Xt|d�r@|j|��7_d|j|<dS)Nr")rr%�hasattrrr")rr4r#rrrr2Es
z BaseTestSuite._removeTestAtIndexcOs|j||�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�dkrd|_}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.debugc	Cs2t|dd�}|j}||krdS|jr(dSt|dd�r8dSz
d|_Wntk
rVYnXt|dd�}|dk	�r.t|d�z^z
|�WnNt
k
r�}z0t|t�r��d|_t
�|�}|�	||d|�W5d}~XYnXW5t|d�|jdk�r,|��t|j�dk�r,|jD]}|j	||d	d||d
��qXdS)NrF�__unittest_skip__F�
setUpClass�_setupStdout�_restoreStdoutTrr��info)r
rrAr@r%r�doClassCleanups�len�tearDown_exceptions�"_createClassOrModuleLevelException�	ExceptionrrHrr)	rr#r3�
previousClass�currentClassrJ�exc�	className�errrrE�sL





�

�zTestSuite._handleClassSetUpcCs"d}t|dd�}|dk	r|j}|S)NrF)r
r=)rr3�previousModulerTrrr�_get_previous_module�s
zTestSuite._get_previous_modulec	
Cs|�|�}|jj}||krdS|�|�d|_ztj|}Wntk
rRYdSXt|dd�}|dk	�rt	|d�z�z
|�Wn�t
k
�r}zfzt��Wn2t
k
r�}z|�
||d|�W5d}~XYnXt|t�r�d|_|�
||d|�W5d}~XYnXW5t	|d�XdS)NF�setUpModulerKrLT)rZrr=rGrA�sys�modules�KeyErrorr
rrSr�doModuleCleanupsrRrrH)	rr#r3rYZ
currentModule�moduler[rXrVrrrrD�s>




�
�zTestSuite._handleModuleFixtureNcCs$|�d|�d�}|�||||�dS)Nz (�))�_addClassOrModuleLevelException)rr3rVZmethod_namerrN�	errorNamerrrrR�sz,TestSuite._createClassOrModuleLevelExceptioncCs^t|�}t|dd�}|dk	r8t|tj�r8||t|��n"|sN|�|t���n|�||�dS)N�addSkip)	�_ErrorHolderr
rrZSkipTestr.ZaddErrorr\�exc_info)rr3Z	exceptionrcrN�errorrdrrrrb�sz)TestSuite._addClassOrModuleLevelExceptioncCs|�|�}|dkrdS|jr dSztj|}Wntk
rDYdSXt|dd�}|dk	�rt|d�zNz
|�Wn>t	k
r�}z t|t�r��|�
||d|�W5d}~XYnXW5t|d�zt��Wn4t	k
�r}z|�
||d|�W5d}~XYnXXdS)N�tearDownModulerKrL)
rZrAr\r]r^r
rrr_rSrRrrH)rr3rYr`rhrXrrrrG�s:




�
�zTestSuite._handleModuleTearDownc	Cst|dd�}|j}||krdSt|dd�r.dSt|dd�r>dSt|dd�rNdSt|dd�}|dk	�rt|d�zXz
|�WnHt	k
r�}z*t
|t�r��t�|�}|�||d|�W5d}~XYnXW5t|d�|��t|j�d	k�r|jD]&}t�|�}|j||d
d||d�q�XdS)NrFr@FrArI�
tearDownClassrKrLrrrM)r
rrrOrPrQrrrRrSrrH)	rr#r3rTrUrirVrWrXrrrrCsB




�


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

!($�
�
 r*c@sPeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�ZdS)reNcCs
||_dSr��description)rrkrrrrBsz_ErrorHolder.__init__cCs|jSrrjrrrr�idEsz_ErrorHolder.idcCsdSrrrrrr�shortDescriptionHsz_ErrorHolder.shortDescriptioncCsd|jfS)Nz<ErrorHolder description=%r>rjrrrrrKsz_ErrorHolder.__repr__cCs|��Sr)rlrrrr�__str__Nsz_ErrorHolder.__str__cCsdSrr�rr3rrrr5Qsz_ErrorHolder.runcCs
|�|�Srr7rorrrr:Vsz_ErrorHolder.__call__cCsdSrrrrrrr"Ysz_ErrorHolder.countTestCases)r<r=r>ZfailureExceptionrrlrmrrnr5r:r"rrrrre6s
recCs(zt|�Wntk
r"YdSXdS)NTF)r r%)r#rrrrB\s
rBc@seZdZdZdZdZdS)rHNF)r<r=r>rFrAr0rrrrrHesrH)r\�rrZ
__unittestr�objectrr*rerBrHrrrr�<module>sL[&	

?>