Your IP : 18.119.235.107


Current Path : /opt/alt/python310/lib64/python3.10/unittest/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/unittest/__pycache__/suite.cpython-310.opt-2.pyc

o

6��f�4�@sz	ddlZddlmZddlmZdZdd�ZGdd	�d	e�ZGd
d�de�ZGdd
�d
e�Z	dd�Z
Gdd�de�ZdS)�N�)�case)�utilTcCst||dd��}|�dS)NcS�dS�N�rrr�5/opt/alt/python310/lib64/python3.10/unittest/suite.py�<lambda>sz!_call_if_exists.<locals>.<lambda>)�getattr)�parent�attr�funcrrr�_call_if_existss
rc@sleZdZ	dZddd�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__"�
zBaseTestSuite.__iter__cCs$|j}|D]
}|r||��7}q|Sr)r�countTestCases)r�cases�testrrrr#%s�zBaseTestSuite.countTestCasescCsLt|�s
td�t|����t|t�rt|tjt	f�rtd��|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�r	td��|D]}|�|�qdS)Nz0tests must be an iterable of tests, not a string)r�strr'r/)rrr%rrrr6s

�zBaseTestSuite.addTestscCs:t|�D]\}}|jr|S||�|jr|�|�q|Sr)�	enumerate�
shouldStop�_cleanup�_removeTestAtIndex)r�result�indexr%rrr�run<s�
�zBaseTestSuite.runcCsP	z|j|}Wn
tyYdSwt|d�r!|j|��7_d|j|<dS)Nr#)rr'�hasattrrr#)rr6r%rrrr4Es�
z BaseTestSuite._removeTestAtIndexcOs|j|i|��Sr�r7)r�args�kwdsrrr�__call__SszBaseTestSuite.__call__cCs	|D]}|��qdSr)�debugr.rrrr=Vs
�zBaseTestSuite.debugN)r)�__name__�
__module__�__qualname__r3rrrr!r#r/rr7r4r<r=rrrrrs

	rc@s`eZdZ	ddd�Zdd�Zdd�Zdd	�Zd
d�Z	dd
d�Z	ddd�Z	dd�Z
dd�ZdS)r,FcCs�d}t|dd�durd|_}t|�D]D\}}|jrn<t|�rD|�||�|�||�|�||�|j|_	t|jdd�sCt|dd�rDq|sK||�n|�
�|jrW|�|�q|rh|�d|�|�
|�d|_|S)NF�_testRunEnteredT�_classSetupFailed�_moduleSetUpFailed)r
rAr1r2�_isnotsuite�_tearDownPreviousClass�_handleModuleFixture�_handleClassSetUpr�_previousTestClassr=r3r4�_handleModuleTearDown)rr5r=ZtopLevelr6r%rrrr7fs4

�

�
z
TestSuite.runcCs	t�}|�|d�dS)NT)�_DebugResultr7)rr=rrrr=�szTestSuite.debugcCstt|dd�}|j}||krdS|jrdSt|dd�rdSd}zd|_Wn	ty,Ynwt|dd�}t|dd�}|dur�t|d�zoz|�Wn6ty~}z*t|t�rV�d}zd|_Wn	tyfYnwt	�
|�}	|�||d|	�WYd}~nd}~ww|r�|dur�|�|jD]}
|j||
dd|	|
d	�q�Wt|d
�dSWt|d
�dSWt|d
�dSt|d
�wdS)NrH�__unittest_skip__F�
setUpClass�doClassCleanups�_setupStdoutTr��info�_restoreStdout)
r
rrCrBr'r�	ExceptionrrJrr�"_createClassOrModuleLevelException�tearDown_exceptions)rr%r5�
previousClass�currentClassZfailedrLrM�e�	className�exc_inforrrrG�sf
�



�
���
�����zTestSuite._handleClassSetUpcCs"d}t|dd�}|dur|j}|S)NrH)r
r?)rr5�previousModulerUrrr�_get_previous_module�s
zTestSuite._get_previous_modulec
CsL|�|�}|jj}||krdS|�|�d|_ztj|}Wn
ty(YdSwt|dd�}|dur�t	|d�zez|�Wn#t
ya}zt|t�rL�d|_|�
||d|�WYd}~nd}~ww|jr�zt��Wn"t
y�}z|�
||d|�WYd}~nd}~wwWt	|d�dSWt	|d�dSWt	|d�dSt	|d�wdS)NF�setUpModulerNTrQ)r[rr?rIrC�sys�modules�KeyErrorr
rrRrrJrSr�doModuleCleanups)rr%r5rZZ
currentModule�moduler\rWrrrrF�sX

�


����������zTestSuite._handleModuleFixtureNcCs$|�d|�d�}|�||||�dS)Nz (�))�_addClassOrModuleLevelException)rr5�excZmethod_namerrP�	errorNamerrrrS�sz,TestSuite._createClassOrModuleLevelExceptioncCsbt|�}t|dd�}|durt|tj�r||t|��dS|s)|�|t���dS|�||�dS)N�addSkip)	�_ErrorHolderr
rrZSkipTestr0ZaddErrorr]rY)rr5Z	exceptionrerP�errorrfrrrrc�sz)TestSuite._addClassOrModuleLevelExceptionc
Cs*|�|�}|durdS|jrdSztj|}Wn
ty!YdSwt|d�zgt|dd�}|durXz|�Wn tyW}zt|t	�rE�|�
||d|�WYd}~nd}~wwzt��Wn ty~}zt|t	�rl�|�
||d|�WYd}~n
d}~wwWt|d�dSWt|d�dSt|d�w)NrN�tearDownModulerQ)
r[rCr]r^r_rr
rRrrJrSrr`)rr5rZrarirWrrrrI�sP
�


���
�����zTestSuite._handleModuleTearDownc

Csft|dd�}|j}||ks|durdSt|dd�rdSt|dd�r#dSt|dd�r+dSt|dd�}t|dd�}|durA|durAdSt|d�zf|durvz|�Wn%tyu}zt|t�r^�t�|�}|�||d|�WYd}~nd}~ww|dur�|�|j	D]$}	t|t�r�|	d	�t�|�}|j||	d	d||	d
�q�Wt|d�dSWt|d�dSt|d�w)NrHrBFrCrK�
tearDownClassrMrNrrOrQ)
r
rrrRrrJrrrSrT)
rr%r5rUrVrjrMrWrXrYrrrrEsX



���


���	z TestSuite._tearDownPreviousClass)Fr)r>r?r@r7r=rGr[rFrSrcrIrErrrrr,\s
	!.&
�
�#r,c@sReZdZ	dZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�ZdS)rgNcCs
||_dSr��description)rrlrrrrTr"z_ErrorHolder.__init__cCs|jSrrkrrrr�idWsz_ErrorHolder.idcCrrrrrrr�shortDescriptionZ�z_ErrorHolder.shortDescriptioncCsd|jfS)Nz<ErrorHolder description=%r>rkrrrrr]sz_ErrorHolder.__repr__cCs|��Sr)rmrrrr�__str__`sz_ErrorHolder.__str__cCrrr�rr5rrrr7csz_ErrorHolder.runcCs
|�|�Srr9rqrrrr<hr"z_ErrorHolder.__call__cCsdSrrrrrrr#kroz_ErrorHolder.countTestCases)r>r?r@ZfailureExceptionrrmrnrrpr7r<r#rrrrrgHs	rgcCs&	zt|�WdStyYdSw)NTF)r r')r%rrrrDns
��rDc@seZdZ	dZdZdZdS)rJNF)r>r?r@rHrCr2rrrrrJws
rJ)r]�rrZ
__unittestr�objectrr,rgrDrJrrrr�<module>sLm&	

?>