AlkantarClanX12

Your IP : 3.145.103.169


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.pyc

a

R�f�4�@s|dZddlZddlmZddlmZdZdd�ZGd	d
�d
e�ZGdd�de�Z	Gdd
�d
e�Z
dd�ZGdd�de�ZdS)�	TestSuite�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@sneZdZdZdZddd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZdS)�
BaseTestSuitezNA simple test suite that doesn't provide class or module shared fixtures.
    TrcCsg|_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�
issubclassrZTestCaserr�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)z2Stop holding a reference to the TestCase at index.r#N)rr&�hasattrrr#)rr4r$rrrr2Es
z BaseTestSuite._removeTestAtIndexcOs|j|i|��Sr�r5)r�args�kwdsrrr�__call__SszBaseTestSuite.__call__cCs|D]}|��qdS)�7Run the tests without collecting errors in a TestResultN)�debugr,rrrr<VszBaseTestSuite.debugN)r)�__name__�
__module__�__qualname__�__doc__r1rrr r"r#r-rr5r2r:r<rrrrrs

	rc@s^eZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zddd�Z	ddd�Z
dd�Zdd�Zd
S)ra�A test suite is a composite test consisting of a number of TestCases.

    For use, create an instance of TestSuite, then add test case instances.
    When all tests have been added, the suite can be passed to a test
    runner, such as TextTestRunner. It will run the individual test cases
    in the order in which they were added, aggregating the results. When
    subclassing, do not forget to call the base class constructor.
    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)rrAr/r0�_isnotsuite�_tearDownPreviousClass�_handleModuleFixture�_handleClassSetUpr�_previousTestClassr<r1r2�_handleModuleTearDown)rr3r<ZtopLevelr4r$rrrr5fs2

�

z
TestSuite.runcCst�}|�|d�dS)r;TN)�_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)NrH�__unittest_skip__F�
setUpClass�doClassCleanups�_setupStdoutTr��info�_restoreStdout)
rrrCrBr&r�	ExceptionrrJrr�"_createClassOrModuleLevelException�tearDown_exceptions)rr$r3�
previousClass�currentClassZfailedrLrM�e�	className�exc_inforrrrG�sR






�
�zTestSuite._handleClassSetUpcCs"d}t|dd�}|dur|j}|S)NrH)rr>)rr3�previousModulerUrrr�_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�setUpModulerNTrQ)r[rr>rIrC�sys�modules�KeyErrorrrrRrrJrSr�doModuleCleanups)rr$r3rZZ
currentModule�moduler\rWrrrrF�sB





��zTestSuite._handleModuleFixtureNcCs$|�d|�d�}|�||||�dS)Nz (�))�_addClassOrModuleLevelException)rr3�excZmethod_namerrP�	errorNamerrrrS�sz,TestSuite._createClassOrModuleLevelExceptioncCs^t|�}t|dd�}|dur8t|tj�r8||t|��n"|sN|�|t���n|�||�dS)N�addSkip)	�_ErrorHolderrrrZSkipTestr.ZaddErrorr]rY)rr3Z	exceptionrerP�errorrfrrrrc�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)NrN�tearDownModulerQ)
r[rCr]r^r_rrrRrrJrSrr`)rr3rZrarirWrrrrI�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)NrHrBFrCrK�
tearDownClassrMrNrrOrQ)
rrrrRrrJrrrSrT)
rr$r3rUrVrjrMrWrXrYrrrrEsN



�


�z TestSuite._tearDownPreviousClass)F)N)N)
r=r>r?r@r5r<rGr[rFrSrcrIrErrrrr\s	
!.&�
�
#c@sTeZdZdZdZdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�ZdS)rgz�
    Placeholder for a TestCase inside a result. As far as a TestResult
    is concerned, this looks exactly like a unit test. Used to insert
    arbitrary errors into a test suite run.
    NcCs
||_dSr��description)rrlrrrrTsz_ErrorHolder.__init__cCs|jSrrkrrrr�idWsz_ErrorHolder.idcCsdSrrrrrr�shortDescriptionZsz_ErrorHolder.shortDescriptioncCsd|jfS)Nz<ErrorHolder description=%r>rkrrrrr]sz_ErrorHolder.__repr__cCs|��Sr)rmrrrr�__str__`sz_ErrorHolder.__str__cCsdSrr�rr3rrrr5csz_ErrorHolder.runcCs
|�|�Srr7rprrrr:hsz_ErrorHolder.__call__cCsdSrrrrrrr#ksz_ErrorHolder.countTestCases)
r=r>r?r@ZfailureExceptionrrmrnrror5r:r#rrrrrgHs	rgcCs&zt|�Wnty YdS0dS)z?A crude way to tell apart testcases and suites with duck-typingTF)r!r&)r$rrrrDns
rDc@seZdZdZdZdZdZdS)rJzCUsed by the TestSuite to hold previous class when running in debug.NF)r=r>r?r@rHrCr0rrrrrJwsrJ)
r@r]�rrZ
__unittestr�objectrrrgrDrJrrrr�<module>sLm&