AlkantarClanX12

Your IP : 18.223.195.127


Current Path : /proc/self/root/opt/alt/python35/lib64/python3.5/unittest/__pycache__/
Upload File :
Current File : //proc/self/root/opt/alt/python35/lib64/python3.5/unittest/__pycache__/suite.cpython-35.opt-2.pyc



���]�(�@s�ddlZddlmZddlmZdZdd�ZGdd	�d	e�ZGd
d�de�ZGdd
�d
e�Z	dd�Z
Gdd�de�ZdS)�N�)�case)�utilTcCs#t||dd��}|�dS)NcSsdS)N�rrr�*/opt/alt/python35/lib64/python3.5/suite.py�<lambda>sz!_call_if_exists.<locals>.<lambda>)�getattr)�parent�attr�funcrrr�_call_if_existssrc@s�eZdZdZfdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)�
BaseTestSuiteTcCs#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__cCs4|j}x$|D]}|r||j�7}qW|S)N)r�countTestCases)rZcases�testrrrr%s
	
zBaseTestSuite.countTestCasescCsnt|�s'tdjt|����t|t�rZt|tjt	f�rZtd��|j
j|�dS)Nz{} is not callablezNTestCases and TestSuites must be instantiated before passing them to addTest())�callable�	TypeError�format�reprr�type�
issubclassrZTestCase�	TestSuiter�append)rrrrr�addTest,szBaseTestSuite.addTestcCs=t|t�rtd��x|D]}|j|�q"WdS)Nz0tests must be an iterable of tests, not a string)r�strr!r()rrrrrrr6s
zBaseTestSuite.addTestscCsKxDt|�D]6\}}|jr#P||�|jr
|j|�q
W|S)N)�	enumerate�
shouldStop�_cleanup�_removeTestAtIndex)r�result�indexrrrr�run<s	
	zBaseTestSuite.runcCs[y|j|}Wntk
r%Yn2Xt|d�rJ|j|j�7_d|j|<dS)Nr)rr!�hasattrrr)rr/rrrrr-Es
z BaseTestSuite._removeTestAtIndexcOs|j||�S)N)r0)r�args�kwdsrrr�__call__SszBaseTestSuite.__call__cCsx|D]}|j�qWdS)N)�debug)rrrrrr5Vs
zBaseTestSuite.debugN)�__name__�
__module__�__qualname__r,rrrrrr(rr0r-r4r5rrrrr
s
	r
c@sseZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dS)r&FcCs'd}t|dd�dkr+d|_}x�t|�D]�\}}|jrNPt|�r�|j||�|j||�|j||�|j|_	t|jdd�s8t|dd�r�q8|s�||�n
|j
�|jr8|j|�q8W|r#|jd|�|j
|�d|_|S)NF�_testRunEnteredT�_classSetupFailed�_moduleSetUpFailed)rr9r*r+�_isnotsuite�_tearDownPreviousClass�_handleModuleFixture�_handleClassSetUpr�_previousTestClassr5r,r-�_handleModuleTearDown)rr.r5ZtopLevelr/rrrrr0fs0
	

	
	z
TestSuite.runcCst�}|j|d�dS)NT)�_DebugResultr0)rr5rrrr5�s	zTestSuite.debugc	 Cs.t|dd�}|j}||kr+dS|jr8dSt|dd�rNdSy
d|_Wntk
roYnXt|dd�}|dk	r*t|d�z~y|�Wnltk
r}zLt|t�r��d|_t	j
|�}d|}|j|||�WYdd}~XnXWdt|d�XdS)	Nr@�__unittest_skip__F�
setUpClass�_setupStdoutTzsetUpClass (%s)�_restoreStdout)rrr;r:r!r�	ExceptionrrBrr�_addClassOrModuleLevelException)	rrr.�
previousClass�currentClassrD�e�	className�	errorNamerrrr?�s2		


	
*zTestSuite._handleClassSetUpcCs1d}t|dd�}|dk	r-|j}|S)Nr@)rr7)rr.�previousModulerIrrr�_get_previous_module�s
	zTestSuite._get_previous_modulec	 Cs|j|�}|jj}||kr+dS|j|�d|_ytj|}Wntk
rjdSYnXt|dd�}|dk	rt	|d�zoy|�Wn]t
k
r}z=t|t�r��d|_d|}|j
|||�WYdd}~XnXWdt	|d�XdS)NF�setUpModulerETzsetUpModule (%s)rF)rOrr7rAr;�sys�modules�KeyErrorrrrGrrBrH)	rrr.rNZ
currentModule�modulerPrKrMrrrr>�s,
	
	
	
*zTestSuite._handleModuleFixturecCslt|�}t|dd�}|dk	rRt|tj�rR||t|��n|j|tj��dS)N�addSkip)	�_ErrorHolderrrrZSkipTestr)ZaddErrorrQ�exc_info)rr.�	exceptionrM�errorrUrrrrH�s
z)TestSuite._addClassOrModuleLevelExceptionc Cs�|j|�}|dkrdS|jr,dSytj|}Wntk
rUdSYnXt|dd�}|dk	r�t|d�zfy|�WnTtk
r�}z4t|t	�r��d|}|j
|||�WYdd}~XnXWdt|d�XdS)N�tearDownModulerEztearDownModule (%s)rF)rOr;rQrRrSrrrGrrBrH)rr.rNrTrZrKrMrrrrA�s(	
	

*zTestSuite._handleModuleTearDownc	Cs"t|dd�}|j}||kr+dSt|dd�rAdSt|dd�rWdSt|dd�rmdSt|dd�}|dk	rt|d�zuy|�Wnctk
r}zCt|t�r��tj|�}d|}|j|||�WYdd}~XnXWdt|d	�XdS)
Nr@r:Fr;rC�
tearDownClassrEztearDownClass (%s)rF)	rrrrGrrBrrrH)	rrr.rIrJr[rKrLrMrrrr=�s,	

*z TestSuite._tearDownPreviousClassN)r6r7r8r0r5r?rOr>rHrAr=rrrrr&\s
! r&c@sveZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�ZdS)rVNcCs
||_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)r6r7r8ZfailureExceptionrr]r^rr_r0r4rrrrrrVs
rVcCs+yt|�Wntk
r&dSYnXdS)NTF)rr!)rrrrr<4s

	r<c@s"eZdZdZdZdZdS)rBNF)r6r7r8r@r;r+rrrrrB=srB)rQ�rrZ
__unittestr�objectr
r&rVr<rBrrrr�<module>sL�&