ok

Mini Shell

Direktori : /proc/thread-self/root/opt/alt/python37/lib64/python3.7/unittest/__pycache__/
Upload File :
Current File : //proc/thread-self/root/opt/alt/python37/lib64/python3.7/unittest/__pycache__/suite.cpython-37.pyc

B

� f�(�@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/python37/lib64/python3.7/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|�kS)N)�
isinstancer�NotImplementedr)r�otherrrr�__eq__szBaseTestSuite.__eq__cCs
t|j�S)N)�iterr)rrrr�__iter__"szBaseTestSuite.__iter__cCs(|j}x|D]}|r||��7}qW|S)N)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��x|D]}|�|�qWdS)Nz0tests must be an iterable of tests, not a string)r�strr#r))rrr!rrrr6s

zBaseTestSuite.addTestscCs:x4t|�D](\}}|jrP||�|jr
|�|�q
W|S)N)�	enumerate�
shouldStop�_cleanup�_removeTestAtIndex)r�result�indexr!rrr�run<szBaseTestSuite.runcCsNy|j|}Wntk
r"Yn(Xt|d�r@|j|��7_d|j|<dS)z2Stop holding a reference to the TestCase at index.r N)rr#�hasattrrr )rr0r!rrrr.Es
z BaseTestSuite._removeTestAtIndexcOs|j||�S)N)r1)r�args�kwdsrrr�__call__SszBaseTestSuite.__call__cCsx|D]}|��qWdS)z7Run the tests without collecting errors in a TestResultN)�debug)rr!rrrr6Vs
zBaseTestSuite.debugN)r)�__name__�
__module__�__qualname__�__doc__r-rrrrr r)rr1r.r5r6rrrrrs

	rc@sReZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZdS)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�dkrd|_}x�t|�D]�\}}|jr8Pt|�r�|�||�|�||�|�||�|j|_	t|jdd�s(t|dd�r�q(|s�||�n|�
�|jr(|�|�q(W|r�|�d|�|�
|�d|_|S)NF�_testRunEnteredT�_classSetupFailed�_moduleSetUpFailed)r
r;r+r,�_isnotsuite�_tearDownPreviousClass�_handleModuleFixture�_handleClassSetUpr�_previousTestClassr6r-r.�_handleModuleTearDown)rr/r6ZtopLevelr0r!rrrr1fs0


z
TestSuite.runcCst�}|�|d�dS)z7Run the tests without collecting errors in a TestResultTN)�_DebugResultr1)rr6rrrr6�szTestSuite.debugc	
Cs�t|dd�}|j}||krdS|jr(dSt|dd�r8dSy
d|_Wntk
rVYnXt|dd�}|dk	r�t|d�zdy
|�WnTtk
r�}z6t|t�r��d|_t	�
|�}d|}|�|||�Wdd}~XYnXWdt|d�XdS)	NrB�__unittest_skip__F�
setUpClass�_setupStdoutTzsetUpClass (%s)�_restoreStdout)r
rr=r<r#r�	ExceptionrrDrr�_addClassOrModuleLevelException)	rr!r/�
previousClass�currentClassrF�e�	className�	errorNamerrrrA�s2




$zTestSuite._handleClassSetUpcCs"d}t|dd�}|dk	r|j}|S)NrB)r
r8)rr/�previousModulerKrrr�_get_previous_module�s
zTestSuite._get_previous_modulec	
Cs�|�|�}|jj}||krdS|�|�d|_ytj|}Wntk
rPdSXt|dd�}|dk	r�t	|d�zZy
|�WnJt
k
r�}z,t|t�r��d|_d|}|�
|||�Wdd}~XYnXWdt	|d�XdS)NF�setUpModulerGTzsetUpModule (%s)rH)rQrr8rCr=�sys�modules�KeyErrorr
rrIrrDrJ)	rr!r/rPZ
currentModule�modulerRrMrOrrrr@�s,




$zTestSuite._handleModuleFixturecCsLt|�}t|dd�}|dk	r8t|tj�r8||t|��n|�|t���dS)N�addSkip)	�_ErrorHolderr
rrZSkipTestr*ZaddErrorrS�exc_info)rr/Z	exceptionrO�errorrWrrrrJ�s
z)TestSuite._addClassOrModuleLevelExceptionc
Cs�|�|�}|dkrdS|jr dSytj|}Wntk
rBdSXt|dd�}|dk	r�t|d�zTy
|�WnDtk
r�}z&t|t	�r��d|}|�
|||�Wdd}~XYnXWdt|d�XdS)N�tearDownModulerGztearDownModule (%s)rH)rQr=rSrTrUr
rrIrrDrJ)rr/rPrVr[rMrOrrrrC�s(



$zTestSuite._handleModuleTearDownc	
Cs�t|dd�}|j}||krdSt|dd�r.dSt|dd�r>dSt|dd�rNdSt|dd�}|dk	r�t|d�z^y
|�WnNtk
r�}z0t|t�r��t�|�}d|}|�|||�Wdd}~XYnXWdt|d	�XdS)
NrBr<Fr=rE�
tearDownClassrGztearDownClass (%s)rH)	r
rrrIrrDrrrJ)	rr!r/rKrLr\rMrNrOrrrr?�s,



$z TestSuite._tearDownPreviousClassN)F)r7r8r9r:r1r6rArQr@rJrCr?rrrrr\s
! c@sTeZdZdZdZdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�ZdS)rXz�
    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
||_dS)N)�description)rr]rrrrsz_ErrorHolder.__init__cCs|jS)N)r])rrrr�idsz_ErrorHolder.idcCsdS)Nr)rrrr�shortDescription sz_ErrorHolder.shortDescriptioncCsd|jfS)Nz<ErrorHolder description=%r>)r])rrrrr#sz_ErrorHolder.__repr__cCs|��S)N)r^)rrrr�__str__&sz_ErrorHolder.__str__cCsdS)Nr)rr/rrrr1)sz_ErrorHolder.runcCs
|�|�S)N)r1)rr/rrrr5.sz_ErrorHolder.__call__cCsdS)Nrr)rrrrr 1sz_ErrorHolder.countTestCases)
r7r8r9r:ZfailureExceptionrr^r_rr`r1r5r rrrrrXsrXcCs&yt|�Wntk
r dSXdS)z?A crude way to tell apart testcases and suites with duck-typingTF)rr#)r!rrrr>4s
r>c@seZdZdZdZdZdZdS)rDzCUsed by the TestSuite to hold previous class when running in debug.NF)r7r8r9r:rBr=r,rrrrrD=srD)
r:rS�rrZ
__unittestr�objectrrrXr>rDrrrr�<module>sL3&	

Zerion Mini Shell 1.0