ok

Mini Shell

Direktori : /proc/thread-self/root/opt/alt/python34/lib64/python3.4/unittest/__pycache__/
Upload File :
Current File : //proc/thread-self/root/opt/alt/python34/lib64/python3.4/unittest/__pycache__/suite.cpython-34.pyo

�
j f�(�@s�dZddlZddlmZddlmZdZdd�ZGd	d
�d
e�ZGdd�de�Z	Gdd
�d
e�Z
dd�ZGdd�de�ZdS)�	TestSuite�N�)�case)�utilTcCs#t||dd��}|�dS)NcSsdS)N�rrr�3/opt/alt/python34/lib64/python3.4/unittest/suite.py�<lambda>sz!_call_if_exists.<locals>.<lambda>)�getattr)�parent�attr�funcrrr�_call_if_existssr
c@s�eZdZdZdZfdd�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.
    TcCs#g|_d|_|j|�dS)Nr)�_tests�_removed_tests�addTests)�self�testsrrr�__init__s		zBaseTestSuite.__init__cCs dtj|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__szBaseTestSuite.__eq__cCs
t|j�S)N)�iterr)rrrr�__iter__"szBaseTestSuite.__iter__cCs7|j}x'|D]}|r||j�7}qqW|S)N)r�countTestCases)rZcases�testrrrr%s
	
zBaseTestSuite.countTestCasescCstt|�s*tdjt|����nt|t�r`t|tjt	f�r`td��n|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��nx|D]}|j|�q%WdS)Nz0tests must be an iterable of tests, not a string)r�strr"r()rrr rrrr6s
zBaseTestSuite.addTestscCsQxJt|�D]<\}}|jr&Pn||�|jr
|j|�q
q
W|S)N)�	enumerate�
shouldStop�_cleanup�_removeTestAtIndex)r�result�indexr rrr�run<s	
	zBaseTestSuite.runcCs^y|j|}Wntk
r%Yn5Xt|d�rM|j|j�7_nd|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@syeZdZdZddd�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.
    FcCs9d}t|dd�dkr.d|_}nx�t|�D]�\}}|jrTPnt|�r�|j||�|j||�|j||�|j|_	t|jdd�s;t|dd�r�q;q�n|s�||�n
|j
�|jr;|j|�q;q;W|r5|jd|�|j
|�d|_n|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�s	zTestSuite.debugc	 Cs4t|dd�}|j}||kr+dS|jr8dSt|dd�rNdSy
d|_Wntk
roYnXt|dd�}|dk	r0t|d�z�y|�Wnotk
r}zOt|t�r��nd|_t	j
|�}d|}|j|||�WYdd}~XnXWdt|d�XndS)	NrA�__unittest_skip__F�
setUpClass�_setupStdoutTzsetUpClass (%s)�_restoreStdout)r	rr<r;r"r
�	ExceptionrrCrr�_addClassOrModuleLevelException)	rr r.�
previousClass�currentClassrE�e�	className�	errorNamerrrr@�s2		


	
*zTestSuite._handleClassSetUpcCs4d}t|dd�}|dk	r0|j}n|S)NrA)r	r7)rr.�previousModulerJrrr�_get_previous_module�s
zTestSuite._get_previous_modulec	 Cs |j|�}|jj}||kr+dS|j|�d|_ytj|}Wntk
rjdSYnXt|dd�}|dk	rt	|d�zry|�Wn`t
k
r}z@t|t�r��nd|_d|}|j
|||�WYdd}~XnXWdt	|d�XndS)NF�setUpModulerFTzsetUpModule (%s)rG)rPrr7rBr<�sys�modules�KeyErrorr	r
rHrrCrI)	rr r.rOZ
currentModule�modulerQrLrNrrrr?�s,
	
	
	
*zTestSuite._handleModuleFixturecCslt|�}t|dd�}|dk	rRt|tj�rR||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
rUdSYnXt|dd�}|dk	r�t|d�ziy|�WnWtk
r�}z7t|t	�r��nd|}|j
|||�WYdd}~XnXWdt|d�XndS)N�tearDownModulerFztearDownModule (%s)rG)rPr<rRrSrTr	r
rHrrCrI)rr.rOrUrZrLrNrrrrB�s(	
	

*zTestSuite._handleModuleTearDownc	Cs(t|dd�}|j}||kr+dSt|dd�rAdSt|dd�rWdSt|dd�rmdSt|dd�}|dk	r$t|d�zxy|�Wnftk
r}zFt|t�r��ntj|�}d|}|j|||�WYdd}~XnXWdt|d	�XndS)
NrAr;Fr<rD�
tearDownClassrFztearDownClass (%s)rG)	r	rr
rHrrCrrrI)	rr r.rJrKr[rLrMrNrrrr>�s,	

*z TestSuite._tearDownPreviousClassN)r6r7r8r9r0r5r@rPr?rIrBr>rrrrr\s! c@s|eZdZdZdZdd�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.shortDescriptioncCsd|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_r0r4rrrrrrWsrWcCs+yt|�Wntk
r&dSYnXdS)z?A crude way to tell apart testcases and suites with duck-typingTF)rr")r rrrr=4s

	r=c@s(eZdZdZdZdZdZdS)rCzCUsed by the TestSuite to hold previous class when running in debug.NF)r6r7r8r9rAr<r+rrrrrC=srC)
r9rR�rrZ
__unittestr
�objectrrrWr=rCrrrr�<module>sL�&	

Zerion Mini Shell 1.0