AlkantarClanX12

Your IP : 52.14.252.16


Current Path : /proc/self/root/usr/lib64/python3.6/unittest/__pycache__/
Upload File :
Current File : //proc/self/root/usr/lib64/python3.6/unittest/__pycache__/suite.cpython-36.opt-1.pyc

3


 \�(�@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�&/usr/lib64/python3.6/unittest/suite.py�<lambda>sz!_call_if_exists.<locals>.<lambda>)�getattr)�parent�attr�funcrrr�_call_if_existssr
c@speZdZdZdZffdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZdS)�
BaseTestSuitezNA simple test suite that doesn't provide class or module shared fixtures.
    TcCsg|_d|_|j|�dS)Nr)�_tests�_removed_tests�addTests)�self�testsrrr�__init__szBaseTestSuite.__init__cCsdtj|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||j�7}qW|S)N)r�countTestCases)rZcases�testrrrr%s

zBaseTestSuite.countTestCasescCsLt|�stdjt|����t|t�r<t|tjt	f�r<td��|j
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]}|j|�qWdS)Nz0tests must be an iterable of tests, not a string)r�strr"r()rrr rrrr6s

zBaseTestSuite.addTestscCs:x4t|�D](\}}|jrP||�|jr
|j|�q
W|S)N)�	enumerate�
shouldStop�_cleanup�_removeTestAtIndex)r�result�indexr rrr�run<szBaseTestSuite.runcCsNy|j|}Wntk
r"Yn(Xt|d�r@|j|j�7_d|j|<dS)z2Stop holding a reference to the TestCase at index.rN)rr"�hasattrrr)rr/r rrrr-Es
z BaseTestSuite._removeTestAtIndexcOs|j||�S)N)r0)r�args�kwdsrrr�__call__SszBaseTestSuite.__call__cCsx|D]}|j�qWdS)z7Run the tests without collecting errors in a TestResultN)�debug)rr rrrr5Vs
zBaseTestSuite.debugN)�__name__�
__module__�__qualname__�__doc__r,rrrrrr(rr0r-r4r5rrrrrs
	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||�|j||�|j||�|j|_	t|jdd�s(t|dd�r�q(|s�||�n|j
�|jr(|j|�q(W|r�|jd|�|j
|�d|_|S)NF�_testRunEnteredT�_classSetupFailed�_moduleSetUpFailed)r	r:r*r+�_isnotsuite�_tearDownPreviousClass�_handleModuleFixture�_handleClassSetUpr�_previousTestClassr5r,r-�_handleModuleTearDown)rr.r5ZtopLevelr/r rrrr0fs0


z
TestSuite.runcCst�}|j|d�dS)z7Run the tests without collecting errors in a TestResultTN)�_DebugResultr0)rr5rrrr5�szTestSuite.debugc	 Cs�t|dd�}|j}||krdS|jr(dSt|dd�r8dSy
d|_Wntk
rVYnXt|dd�}|dk	r�t|d�zdy
|�WnTtk
r�}z8t|t�r��d|_t	j
|�}d|}|j|||�WYdd}~XnXWdt|d�XdS)	NrA�__unittest_skip__F�
setUpClass�_setupStdoutTzsetUpClass (%s)�_restoreStdout)r	rr<r;r"r
�	ExceptionrrCrr�_addClassOrModuleLevelException)	rr r.�
previousClass�currentClassrE�e�	className�	errorNamerrrr@�s2




$zTestSuite._handleClassSetUpcCs"d}t|dd�}|dk	r|j}|S)NrA)r	r7)rr.�previousModulerJrrr�_get_previous_module�s
zTestSuite._get_previous_modulec	 Cs�|j|�}|jj}||krdS|j|�d|_ytj|}Wntk
rPdSXt|dd�}|dk	r�t	|d�zZy
|�WnJt
k
r�}z.t|t�r��d|_d|}|j
|||�WYdd}~XnXWdt	|d�XdS)NF�setUpModulerFTzsetUpModule (%s)rG)rPrr7rBr<�sys�modules�KeyErrorr	r
rHrrCrI)	rr r.rOZ
currentModule�modulerQrLrNrrrr?�s,




$zTestSuite._handleModuleFixturecCsLt|�}t|dd�}|dk	r8t|tj�r8||t|��n|j|tj��dS)N�addSkip)	�_ErrorHolderr	rrZSkipTestr)ZaddErrorrR�exc_info)rr.Z	exceptionrN�errorrVrrrrI�s
z)TestSuite._addClassOrModuleLevelExceptionc Cs�|j|�}|dkrdS|jr dSytj|}Wntk
rBdSXt|dd�}|dk	r�t|d�zTy
|�WnDtk
r�}z(t|t	�r��d|}|j
|||�WYdd}~XnXWdt|d�XdS)N�tearDownModulerFztearDownModule (%s)rG)rPr<rRrSrTr	r
rHrrCrI)rr.rOrUrZrLrNrrrrB�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�}z2t|t�r��tj|�}d|}|j|||�WYdd}~XnXWdt|d	�XdS)
NrAr;Fr<rD�
tearDownClassrFztearDownClass (%s)rG)	r	rr
rHrrCrrrI)	rr r.rJrKr[rLrMrNrrrr>�s,



$z TestSuite._tearDownPreviousClassN)F)r6r7r8r9r0r5r@rPr?rIrBr>rrrrr\s
! c@sTeZdZdZdZdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�ZdS)rWz�
    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|j�S)N)r])rrrr�__str__&sz_ErrorHolder.__str__cCsdS)Nr)rr.rrrr0)sz_ErrorHolder.runcCs
|j|�S)N)r0)rr.rrrr4.sz_ErrorHolder.__call__cCsdS)Nrr)rrrrr1sz_ErrorHolder.countTestCases)
r6r7r8r9ZfailureExceptionrr]r^rr_r0r4rrrrrrWsrWcCs&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)rCzCUsed by the TestSuite to hold previous class when running in debug.NF)r6r7r8r9rAr<r+rrrrrC=srC)
r9rR�rrZ
__unittestr
�objectrrrWr=rCrrrr�<module>sL3&