AlkantarClanX12

Your IP : 18.191.87.157


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__/case.cpython-35.opt-2.pyc



$�Yf#��@skddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZddl
mZmZmZmZmZdZe�ZdZGdd�de�ZGd	d
�d
e�ZGdd�de�ZGd
d�de�Zdd�Zdd�Zdd�Zdd�Zdd�Z dd�Z!Gdd�d�Z"dd�Z#dd �Z$Gd!d"�d"e"�Z%Gd#d$�d$e%�Z&Gd%d&�d&e%�Z'ej(d'd(d)g�Z)Gd*d+�d+ej*�Z+Gd,d-�d-e"�Z,Gd.d/�d/e�Z-Gd0d1�d1e-�Z.Gd2d3�d3e-�Z/dS)4�N�)�result)�strclass�	safe_repr�_count_diff_all_purpose�_count_diff_hashable�_common_shorten_reprTz@
Diff is %s characters long. Set self.maxDiff to None to see it.c@seZdZdS)�SkipTestN)�__name__�
__module__�__qualname__�r
r
�)/opt/alt/python35/lib64/python3.5/case.pyr	sr	c@seZdZdS)�_ShouldStopN)r
rrr
r
r
rr"src@seZdZdS)�_UnexpectedSuccessN)r
rrr
r
r
rr'src@s7eZdZddd�Zejddd��ZdS)�_OutcomeNcCsLd|_||_t|d�|_d|_g|_d|_g|_dS)NF�
addSubTestT)�expecting_failurer�hasattr�result_supports_subtests�success�skipped�expectedFailure�errors)�selfrr
r
r�__init__.s					z_Outcome.__init__Fccs |j}d|_z�y	dVWn�tk
r5�Yn�tk
r~}z*d|_|jj|t|�f�WYdd}~Xn�tk
r�Ynvtj�}|j	r�||_
nd|_|jj||f�d}Yn)X|jr|jr|jj|df�Wd|jo||_XdS)NTF)
r�KeyboardInterruptr	r�append�strr�sys�exc_inforrrr)r�	test_case�isTestZold_success�er r
r
r�testPartExecutor7s*			
	.
		z_Outcome.testPartExecutor)r
rrr�
contextlib�contextmanagerr$r
r
r
rr-s	rcCs|S)Nr
)�objr
r
r�_idUsr(cs�fdd�}|S)NcsLt|t�s6tj|��fdd��}|}d|_�|_|S)Ncst���dS)N)r	)�args�kwargs)�reasonr
r�skip_wrapper^sz-skip.<locals>.decorator.<locals>.skip_wrapperT)�
isinstance�type�	functools�wraps�__unittest_skip__�__unittest_skip_why__)�	test_itemr,)r+r
r�	decorator\s!		zskip.<locals>.decoratorr
)r+r4r
)r+r�skipXs
r5cCs|rt|�StS)N)r5r()�	conditionr+r
r
r�skipIfhs
r7cCs|st|�StS)N)r5r()r6r+r
r
r�
skipUnlessps
r8cCs
d|_|S)NT)�__unittest_expecting_failure__)r3r
r
rrxs	rcsHt|t�r,t�fdd�|D��St|t�oGt|��S)Nc3s|]}t|��VqdS)N)�_is_subtype)�.0r#)�basetyper
r�	<genexpr>~sz_is_subtype.<locals>.<genexpr>)r-�tuple�allr.�
issubclass)�expectedr<r
)r<rr:|sr:c@s(eZdZdd�Zdd�ZdS)�_BaseTestCaseContextcCs
||_dS)N)r!)rr!r
r
rr�sz_BaseTestCaseContext.__init__cCs.|jj|j|�}|jj|��dS)N)r!�_formatMessage�msg�failureException)r�standardMsgrDr
r
r�
_raiseFailure�sz"_BaseTestCaseContext._raiseFailureN)r
rrrrGr
r
r
rrB�srBcCs!dtjkrt|�StSdS)N�WITHIN_PYTHON_RPM_BUILD)�os�environr5r()r+r
r
r�_skipInRpmBuild�s
rKcs%tj���fdd��}|S)NcsadtjkrPy�||�Wn$tk
rFttj���YnXt�n
�||�dS)NrH)rIrJ�	ExceptionZ_ExpectedFailurerr r)r)r*)�funcr
r�wrapper�s
	z+_expectedFailureInRpmBuild.<locals>.wrapper)r/r0)rMrNr
)rMr�_expectedFailureInRpmBuild�s!rOc@s+eZdZddd�Zdd�ZdS)�_AssertRaisesBaseContextNcCs\tj||�||_||_|dk	r=tj|�}||_d|_d|_dS)N)	rBrrAr!�re�compile�expected_regex�obj_namerD)rrAr!rSr
r
rr�s				z!_AssertRaisesBaseContext.__init__cCszt|j|j�s1td||jf��|r`|ddkr`tjdtd�f}|s�|jdd�|_	|r�tjdt
t|��td�|S|^}}y|j|_
Wn!tk
r�t|�|_
YnX|�|||�WdQRXWdd}XdS)Nz%s() arg 1 must be %srzcallable is None�rDz3%r is an invalid keyword argument for this function)r:rA�
_base_type�	TypeError�_base_type_str�warnings�warn�DeprecationWarning�poprD�next�iterr
rT�AttributeErrorr)r�namer)r*Zcallable_objr
r
r�handle�s.	
	

z_AssertRaisesBaseContext.handle)r
rrrrar
r
r
rrP�s
rPc@s4eZdZeZdZdd�Zdd�ZdS)�_AssertRaisesContextz-an exception type or tuple of exception typescCs|S)Nr
)rr
r
r�	__enter__�sz_AssertRaisesContext.__enter__c
Cs
|dkr�y|jj}Wn!tk
r?t|j�}YnX|jrh|jdj||j��q�|jdj|��n
tj|�t	||j�s�dS|j
d�|_|jdkr�dS|j}|j
t|��s	|jdj|jt|���dS)Nz{} not raised by {}z
{} not raisedFTz"{}" does not match "{}")rAr
r_rrTrG�format�	traceback�clear_framesr@�with_traceback�	exceptionrS�search�pattern)r�exc_type�	exc_value�tb�exc_namerSr
r
r�__exit__�s(
	
	z_AssertRaisesContext.__exit__N)r
rr�
BaseExceptionrVrXrcror
r
r
rrb�srbc@s4eZdZeZdZdd�Zdd�ZdS)�_AssertWarnsContextz(a warning type or tuple of warning typescCssx2tjj�D]!}t|dd�ri|_qWtjdd�|_|jj�|_tj	d|j
�|S)N�__warningregistry__�recordT�always)r�modules�values�getattrrrrY�catch_warnings�warnings_managerrc�simplefilterrA)r�vr
r
rrc	s
z_AssertWarnsContext.__enter__c
Csd|jj|||�|dk	r&dSy|jj}Wn!tk
rYt|j�}YnXd}x�|jD]�}|j}t||j�s�qj|dkr�|}|j	dk	r�|j	j
t|��r�qj||_|j|_|j
|_
dSW|dk	r"|jdj|j	jt|���|jrJ|jdj||j��n|jdj|��dS)Nz"{}" does not match "{}"z{} not triggered by {}z{} not triggered)ryrorAr
r_rrY�messager-rSri�warning�filename�linenorGrdrjrT)rrkrlrmrnZfirst_matching�m�wr
r
rros8
			z_AssertWarnsContext.__exit__N)r
rr�WarningrVrXrcror
r
r
rrqsrq�_LoggingWatcher�records�outputc@s4eZdZdd�Zdd�Zdd�ZdS)�_CapturingHandlercCs&tjj|�tgg�|_dS)N)�logging�Handlerrr��watcher)rr
r
rrAsz_CapturingHandler.__init__cCsdS)Nr
)rr
r
r�flushEsz_CapturingHandler.flushcCs9|jjj|�|j|�}|jjj|�dS)N)r�r�rrdr�)rrsrDr
r
r�emitHsz_CapturingHandler.emitN)r
rrrr�r�r
r
r
rr�<sr�c@s:eZdZdZdd�Zdd�Zdd�ZdS)	�_AssertLogsContextz"%(levelname)s:%(name)s:%(message)scCsStj||�||_|r:tjj||�|_ntj|_d|_dS)N)	rBr�logger_namer��_nameToLevel�get�level�INFOrD)rr!r�r�r
r
rrTs	z_AssertLogsContext.__init__cCs�t|jtj�r(|j}|_ntj|j�}|_tj|j�}t�}|j	|�|j
|_
|jdd�|_|j
|_|j|_|g|_|j|j
�d|_|j
S)NF)r-r�r��Logger�logger�	getLogger�	Formatter�LOGGING_FORMATr��setFormatterr��handlers�old_handlersr��	old_level�	propagate�
old_propagate�setLevel)rr��	formatter�handlerr
r
rrc]s	
	z_AssertLogsContext.__enter__cCs�|j|j_|j|j_|jj|j�|dk	rAdSt|jj	�dkr�|j
djtj
|j�|jj��dS)NFrz-no logs of level {} or higher triggered on {})r�r�r�r�r�r�r��lenr�r�rGrdr��getLevelNamer�r`)rrkrlrmr
r
rronsz_AssertLogsContext.__exit__N)r
rrr�rrcror
r
r
rr�Os	r�c@sGeZdZeZdZd�Zd�ZdZddd	�Z	d
d�Z
dd
�Zdd�Zdd�Z
edd��Zedd��Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zejed(d)��Zd*d+�Zd,d-�Zd.d/�Z d0d1d2�Z!d3d4�Z"d5d6�Z#d7d8�Z$d9d:�Z%d0d;d<�Z&d0d=d>�Z'd0d?d@�Z(dAdB�Z)dCdD�Z*dEdF�Z+d0d0dGdH�Z,dIdJ�Z-d0dKdL�Z.d0dMdN�Z/d0dOdP�Z0d0d0d0dQdR�Z1d0d0d0dSdT�Z2d0d0dUdV�Z3dWdX�Z4d0dYdZ�Z5d0d[d\�Z6d0d]d^�Z7d0d_d`�Z8d0dadb�Z9d0dcdd�Z:d0dedf�Z;d0dgdh�Z<d0didj�Z=d0dkdl�Z>d0dmdn�Z?d0dodp�Z@d0dqdr�ZAd0dsdt�ZBd0dudv�ZCd0dwdx�ZDd0dydz�ZEd0d{d|�ZFd0d}d~�ZGdd��ZHd�d��ZId0d�d��ZJd0d�d��ZKd�d��ZLeLe/�ZMZNeLe0�ZOZPeLe1�ZQZReLe2�ZSZTeLe(�ZUZVeLe*�ZWeLe'�ZXeLeH�ZYeLeJ�ZZeLeK�Z[d0S)��TestCaseT�P���F�runTestcCs�||_d|_d|_yt||�}Wn7tk
rg|dkrctd|j|f��Yn
X|j|_g|_d|_	i|_
|jtd�|jt
d�|jtd�|jtd�|jtd�|jtd�dS)	NzNo testr�zno such test method in %s: %s�assertDictEqual�assertListEqual�assertTupleEqual�assertSetEqual�assertMultiLineEqual)�_testMethodName�_outcome�_testMethodDocrwr_�
ValueError�	__class__�__doc__�	_cleanups�_subtest�_type_equality_funcs�addTypeEqualityFunc�dict�listr>�set�	frozensetr)rZ
methodName�
testMethodr
r
rr�s&			
			zTestCase.__init__cCs||j|<dS)N)r�)rZtypeobj�functionr
r
rr��s
zTestCase.addTypeEqualityFunccOs|jj|||f�dS)N)r�r)rr�r)r*r
r
r�
addCleanup�szTestCase.addCleanupcCsdS)Nr
)rr
r
r�setUp�szTestCase.setUpcCsdS)Nr
)rr
r
r�tearDown�szTestCase.tearDowncCsdS)Nr
)�clsr
r
r�
setUpClass�szTestCase.setUpClasscCsdS)Nr
)r�r
r
r�
tearDownClass�szTestCase.tearDownClasscCsdS)Nrr
)rr
r
r�countTestCases�szTestCase.countTestCasescCs
tj�S)N)rZ
TestResult)rr
r
r�defaultTestResult�szTestCase.defaultTestResultcCs,|j}|r(|jd�dj�p+dS)N�
r)r��split�strip)r�docr
r
r�shortDescription�s	zTestCase.shortDescriptioncCsdt|j�|jfS)Nz%s.%s)rr�r�)rr
r
r�idszTestCase.idcCs,t|�t|�k	rtS|j|jkS)N)r.�NotImplementedr�)r�otherr
r
r�__eq__szTestCase.__eq__cCstt|�|jf�S)N)�hashr.r�)rr
r
r�__hash__szTestCase.__hash__cCsd|jt|j�fS)Nz%s (%s))r�rr�)rr
r
r�__str__szTestCase.__str__cCsdt|j�|jfS)Nz<%s testMethod=%s>)rr�r�)rr
r
r�__repr__szTestCase.__repr__cCsRt|dd�}|dk	r.|||�n tjdtd�|j|�dS)N�addSkipz4TestResult has no addSkip method, skips not reportedr�)rwrYrZ�RuntimeWarning�
addSuccess)rrr!r+r�r
r
r�_addSkips	
zTestCase._addSkipcks�|jjsdVdS|j}|dkr<tj|�}n|jj|�}t|||�|_zt|jj|jdd��
dVWdQRX|jj	s�|jj
}|dk	r�|jr�t�n|jj
r�t�Wd||_XdS)Nr"T)r�rr��collections�ChainMap�params�	new_child�_SubTestr$rrZfailfastrr)rrDr��parentZ
params_maprr
r
r�subTests$		
zTestCase.subTestcCs�x�|D]y\}}t|t�r;|j|j||�q|dk	rt|d|j�rp|j||�q|j||�qWdS)Nr)r-r�rr!r@rE�
addFailureZaddError)rrr�testr r
r
r�_feedErrorsToResult=szTestCase._feedErrorsToResultcCsPy
|j}Wn/tk
r>tjdt�|j|�YnX|||�dS)Nz@TestResult has no addExpectedFailure method, reporting as passes)�addExpectedFailurer_rYrZr�r�)rrr r�r
r
r�_addExpectedFailureGs

	zTestCase._addExpectedFailurecCsxy
|j}WnZtk
ritjdt�y
td�Wn(tk
rd|j|tj��YnXYnX||�dS)NzCTestResult has no addUnexpectedSuccess method, reporting as failure)	�addUnexpectedSuccessr_rYrZr�rr�rr )rrr�r
r
r�_addUnexpectedSuccessQs

	

 zTestCase._addUnexpectedSuccessNc
(Cs�|}|dkrC|j�}t|dd�}|dk	rC|�|j|�t||j�}t|jdd�s�t|dd�r�z>t|jdd�p�t|dd�}|j|||�Wd|j|�XdSt|dd�}t|dd�}|p	|}t|�}	z'|	|_|	j	|��|j
�WdQRX|	jr�||	_|	j	|dd��|�WdQRXd|	_|	j	|��|j
�WdQRX|j�x*|	jD]\}
}|j||
|�q�W|j||	j�|	jr:|r-|	jr|j||	j�q:|j|�n
|j|�|SWd|j|�|dkr�t|d	d�}|dk	r�|�|	jj�d|	_d|_XdS)
N�startTestRunr1Fr2�r9r"T�stopTestRun)r�rwZ	startTestr�r�r�ZstopTestrr�r$r�rrr��
doCleanupsrr�rrr�r�r��clear)
rrZorig_resultr�r�Zskip_whyZexpecting_failure_methodZexpecting_failure_classr�outcomer�r+r�r
r
r�run`sh
				
		


	zTestCase.runc
Cse|jpt�}xI|jr]|jj�\}}}|j|��|||�WdQRXqW|jS)N)r�rr�r\r$r)rr�r�r)r*r
r
rr��szTestCase.doCleanupscOs|j||�S)N)r�)rr)�kwdsr
r
r�__call__�szTestCase.__call__cCsc|j�t||j��|j�x5|jr^|jjd�\}}}|||�q*WdS)Nr���)r�rwr�r�r�r\)rr�r)r*r
r
r�debug�s

zTestCase.debugcCst|��dS)N)r	)rr+r
r
r�skipTest�szTestCase.skipTestcCs|j|��dS)N)rE)rrDr
r
r�fail�sz
TestCase.failcCs5|r1|j|dt|��}|j|��dS)Nz%s is not false)rCrrE)r�exprrDr
r
r�assertFalse�szTestCase.assertFalsecCs5|s1|j|dt|��}|j|��dS)Nz%s is not true)rCrrE)rr�rDr
r
r�
assertTrue�szTestCase.assertTruecCsh|js|p|S|dkr#|Syd||fSWn,tk
rcdt|�t|�fSYnXdS)Nz%s : %s)�longMessage�UnicodeDecodeErrorr)rrDrFr
r
rrC�s
	

zTestCase._formatMessagec
Os4t||�}z|jd||�SWdd}XdS)N�assertRaises)rbra)r�expected_exceptionr)r*�contextr
r
rr��szTestCase.assertRaisescOs"t||�}|jd||�S)N�assertWarns)rqra)r�expected_warningr)r*r�r
r
rr�szTestCase.assertWarnscCst|||�S)N)r�)rr�r�r
r
r�
assertLogs'szTestCase.assertLogscCset|�t|�kr^|jjt|��}|dk	r^t|t�rZt||�}|S|jS)N)r.r�r�r-rrw�_baseAssertEqual)r�first�secondZasserterr
r
r�_getAssertEqualityFunc=szTestCase._getAssertEqualityFunccCsD||ks@dt||�}|j||�}|j|��dS)Nz%s != %s)rrCrE)rr�r�rDrFr
r
rr�WszTestCase._baseAssertEqualcCs)|j||�}|||d|�dS)NrD)r�)rr�r�rDZassertion_funcr
r
r�assertEqual^szTestCase.assertEqualcCsG||ksC|j|dt|�t|�f�}|j|��dS)Nz%s == %s)rCrrE)rr�r�rDr
r
r�assertNotEqualeszTestCase.assertNotEqualcCs�||krdS|dk	r4|dk	r4td��|dk	r�t||�|krZdSdt|�t|�t|�f}nT|dkr�d}tt||�|�dkr�dSdt|�t|�|f}|j||�}|j|��dS)Nz specify delta or places not bothz%s != %s within %s delta�rz%s != %s within %r places)rW�absr�roundrCrE)rr�r��placesrD�deltarFr
r
r�assertAlmostEqualns&
		
zTestCase.assertAlmostEqualcCs|dk	r$|dk	r$td��|dk	r||krWt||�|krWdSdt|�t|�t|�f}na|dkr�d}||kr�tt||�|�dkr�dSdt|�t|�|f}|j||�}|j|��dS)Nz specify delta or places not bothz%s == %s within %s deltarrz%s == %s within %r places)rWrrrrCrE)rr�r�rrDrrFr
r
r�assertNotAlmostEqual�s"#	,	
zTestCase.assertNotAlmostEqualc'Cs�|dk	rt|j}t||�sC|jd|t|�f��t||�sz|jd|t|�f��nd}d}yt|�}Wn"ttfk
r�d|}YnX|dkr�yt|�}Wn"ttfk
r�d|}YnX|dkr&||krdSd|j�ft||�}x�t	t
||��D]�}	y||	}
Wn0tttfk
r�|d|	|f7}PYnXy||	}Wn0tttfk
r�|d|	|f7}PYnX|
|krH|d	|	ft|
|�7}PqHW||kr3|dkr3t|�t|�kr3dS||kr�|d
|||f7}y"|d|t||�f7}Wq&tttfk
r�|d||f7}Yq&Xnx||kr&|d
|||f7}y"|d|t||�f7}Wn/tttfk
r%|d||f7}YnX|}ddj
tjtj|�j�tj|�j���}
|j||
�}|j||�}|j|�dS)NzFirst sequence is not a %s: %szSecond sequence is not a %s: %sZsequencez(First %s has no length.    Non-sequence?z)Second %s has no length.    Non-sequence?z%ss differ: %s != %s
z(
Unable to index element %d of first %s
z)
Unable to index element %d of second %s
z#
First differing element %d:
%s
%s
z+
First %s contains %d additional elements.
zFirst extra element %d:
%s
z'Unable to index element %d of first %s
z,
Second %s contains %d additional elements.
z(Unable to index element %d of second %s
r�)r
r-rErr�rW�NotImplementedError�
capitalizer�range�min�
IndexErrorr.�join�difflib�ndiff�pprint�pformat�
splitlines�_truncateMessagerCr�)rZseq1Zseq2rD�seq_typeZ
seq_type_nameZ	differingZlen1Zlen2�iZitem1Zitem2rF�diffMsgr
r
r�assertSequenceEqual�s�				zTestCase.assertSequenceEqualcCsA|j}|dks't|�|kr/||S|tt|�S)N)�maxDiffr��DIFF_OMITTED)rr|�diffZmax_diffr
r
rrs	zTestCase._truncateMessagecCs|j|||dt�dS)Nr)rr�)rZlist1Zlist2rDr
r
rr�s
zTestCase.assertListEqualcCs|j|||dt�dS)Nr)rr>)rZtuple1Ztuple2rDr
r
rr�+s	zTestCase.assertTupleEqualc
 Cs�y|j|�}Wnktk
rK}z|jd|�WYdd}~Xn6tk
r�}z|jd|�WYdd}~XnXy|j|�}Wnktk
r�}z|jd|�WYdd}~Xn6tk
r}z|jd|�WYdd}~XnX|p|sdSg}|rO|jd�x!|D]}|jt|��q2W|r�|jd�x!|D]}|jt|��qiWdj|�}	|j|j||	��dS)Nz/invalid type when attempting set difference: %sz2first argument does not support set difference: %sz3second argument does not support set difference: %sz*Items in the first set but not the second:z*Items in the second set but not the first:r�)�
differencerWr�r_r�reprrrC)
rZset1Zset2rDZdifference1r#Zdifference2�lines�itemrFr
r
rr�6s2
#$#$



zTestCase.assertSetEqualcCsE||krAdt|�t|�f}|j|j||��dS)Nz%s not found in %s)rr�rC)r�member�	containerrDrFr
r
r�assertInaszTestCase.assertIncCsE||krAdt|�t|�f}|j|j||��dS)Nz%s unexpectedly found in %s)rr�rC)rr r!rDrFr
r
r�assertNotInhszTestCase.assertNotIncCsE||k	rAdt|�t|�f}|j|j||��dS)Nz%s is not %s)rr�rC)r�expr1�expr2rDrFr
r
r�assertIsoszTestCase.assertIscCs<||kr8dt|�f}|j|j||��dS)Nzunexpectedly identical: %s)rr�rC)rr$r%rDrFr
r
r�assertIsNotvszTestCase.assertIsNotcCs�|j|td�|j|td�||kr�dt||�}ddjtjtj|�j�tj|�j���}|j	||�}|j
|j||��dS)Nz"First argument is not a dictionaryz#Second argument is not a dictionaryz%s != %sr�)�assertIsInstancer�rrrrrrrrr�rC)rZd1Zd2rDrFrr
r
rr�|szTestCase.assertDictEqualc	Cstjdt�g}g}xv|j�D]h\}}||krQ|j|�q)|||kr)|jdt|�t|�t||�f�q)W|p�|s�dSd}|r�ddjdd�|D��}|r�|r�|d7}|d	dj|�7}|j|j||��dS)
Nz&assertDictContainsSubset is deprecatedz%s, expected: %s, actual: %sr�zMissing: %s�,css|]}t|�VqdS)N)r)r;r�r
r
rr=�sz4TestCase.assertDictContainsSubset.<locals>.<genexpr>z; zMismatched values: %s)	rYrZr[�itemsrrrr�rC)	rZsubsetZ
dictionaryrD�missingZ
mismatched�key�valuerFr
r
r�assertDictContainsSubset�s,		
z!TestCase.assertDictContainsSubsetc
Cs�t|�t|�}}y"tj|�}tj|�}Wn!tk
r^t||�}Yn X||krodSt||�}|r�d}dd�|D�}dj|�}	|j||	�}|j||�}|j	|�dS)NzElement counts were not equal:
cSsg|]}d|�qS)z First has %d, Second has %d:  %rr
)r;rr
r
r�
<listcomp>�s	z-TestCase.assertCountEqual.<locals>.<listcomp>r�)
r�r��CounterrWrrrrrCr�)
rr�r�rDZ	first_seqZ
second_seqZdifferencesrFrrr
r
r�assertCountEqual�s 

zTestCase.assertCountEqualcCs5|j|td�|j|td�||kr1t|�|jks\t|�|jkro|j|||�|jdd�}|jdd�}t|�dkr�|jd�|kr�|dg}|dg}dt||�}dd	jt	j
||��}|j||�}|j|j
||��dS)
NzFirst argument is not a stringzSecond argument is not a string�keependsTrz
r�z%s != %sr�)r(rr��_diffThresholdr�rr�rrrrrr�rC)rr�r�rDZ
firstlinesZsecondlinesrFrr
r
rr��s'

zTestCase.assertMultiLineEqualcCsE||ksAdt|�t|�f}|j|j||��dS)Nz%s not less than %s)rr�rC)r�a�brDrFr
r
r�
assertLess�szTestCase.assertLesscCsE||ksAdt|�t|�f}|j|j||��dS)Nz%s not less than or equal to %s)rr�rC)rr4r5rDrFr
r
r�assertLessEqual�szTestCase.assertLessEqualcCsE||ksAdt|�t|�f}|j|j||��dS)Nz%s not greater than %s)rr�rC)rr4r5rDrFr
r
r�
assertGreater�szTestCase.assertGreatercCsE||ksAdt|�t|�f}|j|j||��dS)Nz"%s not greater than or equal to %s)rr�rC)rr4r5rDrFr
r
r�assertGreaterEqual�szTestCase.assertGreaterEqualcCs<|dk	r8dt|�f}|j|j||��dS)Nz%s is not None)rr�rC)rr'rDrFr
r
r�assertIsNone�szTestCase.assertIsNonecCs/|dkr+d}|j|j||��dS)Nzunexpectedly None)r�rC)rr'rDrFr
r
r�assertIsNotNone�szTestCase.assertIsNotNonecCsBt||�s>dt|�|f}|j|j||��dS)Nz%s is not an instance of %r)r-rr�rC)rr'r�rDrFr
r
rr(�szTestCase.assertIsInstancecCsBt||�r>dt|�|f}|j|j||��dS)Nz%s is an instance of %r)r-rr�rC)rr'r�rDrFr
r
r�assertNotIsInstanceszTestCase.assertNotIsInstancecOs%t|||�}|jd||�S)N�assertRaisesRegex)rbra)rr�rSr)r*r�r
r
rr=s
zTestCase.assertRaisesRegexcOs%t|||�}|jd||�S)N�assertWarnsRegex)rqra)rr�rSr)r*r�r
r
rr>szTestCase.assertWarnsRegexcCskt|ttf�r$tj|�}|j|�sgd|j|f}|j||�}|j|��dS)Nz&Regex didn't match: %r not found in %r)	r-r�bytesrQrRrirjrCrE)r�textrSrDrFr
r
r�assertRegex.szTestCase.assertRegexcCs�t|ttf�r$tj|�}|j|�}|r�d||j�|j��|j|f}|j	||�}|j
|��dS)Nz"Regex matched: %r matches %r in %r)r-rr?rQrRri�start�endrjrCrE)rr@Zunexpected_regexrD�matchrFr
r
r�assertNotRegex:s
zTestCase.assertNotRegexcs�fdd�}|S)Ncs,tjdj�j�td��||�S)NzPlease use {0} instead.r�)rYrZrdr
r[)r)r*)�
original_funcr
r�deprecated_funcJs
z,TestCase._deprecate.<locals>.deprecated_funcr
)rFrGr
)rFr�
_deprecateIszTestCase._deprecatei�i)\r
rr�AssertionErrorrEr�rr3Z_classSetupFailedrr�r�r�r��classmethodr�r�r�r�r�r�r�r�r�r�r�r%r&�_subtest_msg_sentinelr�r�r�r�r�r�r�r�r�r�r�r�rCr�r�r�r�r�rrrrrrr�r�r�r"r#r&r'r�r.r1r�r6r7r8r9r:r;r(r<r=r>rArErHZfailUnlessEqualZassertEqualsZfailIfEqualZassertNotEqualsZfailUnlessAlmostEqualZassertAlmostEqualsZfailIfAlmostEqualZassertNotAlmostEqualsZ
failUnlessZassert_ZfailUnlessRaisesZfailIfZassertRaisesRegexpZassertRegexpMatchesZassertNotRegexpMatchesr
r
r
rr�{s�! 	

E
	!	& c+!	r�cs�eZdZddd�fdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Z�S)�FunctionTestCaseNcs;tt|�j�||_||_||_||_dS)N)�superrLr�
_setUpFunc�
_tearDownFunc�	_testFunc�_description)rZtestFuncr�r��description)r�r
rrhs
			zFunctionTestCase.__init__cCs|jdk	r|j�dS)N)rN)rr
r
rr�oszFunctionTestCase.setUpcCs|jdk	r|j�dS)N)rO)rr
r
rr�sszFunctionTestCase.tearDowncCs|j�dS)N)rP)rr
r
rr�wszFunctionTestCase.runTestcCs
|jjS)N)rPr
)rr
r
rr�zszFunctionTestCase.idcCs\t||j�stS|j|jko[|j|jko[|j|jko[|j|jkS)N)r-r�r�rNrOrPrQ)rr�r
r
rr�}szFunctionTestCase.__eq__cCs+tt|�|j|j|j|jf�S)N)r�r.rNrOrPrQ)rr
r
rr��szFunctionTestCase.__hash__cCsdt|j�|jjfS)Nz%s (%s))rr�rPr
)rr
r
rr��szFunctionTestCase.__str__cCsdt|j�|jfS)Nz<%s tec=%s>)rr�rP)rr
r
rr��szFunctionTestCase.__repr__cCsE|jdk	r|jS|jj}|rA|jd�dj�pDdS)Nr�r)rQrPr�r�r�)rr�r
r
rr��sz!FunctionTestCase.shortDescription)
r
rrrr�r�r�r�r�r�r�r�r�r
r
)r�rrL_s		rLcs^eZdZ�fdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Z�S)
r�cs8t�j�||_||_||_|j|_dS)N)rMr�_messager!r�rE)rr!r|r�)r�r
rr�s

			z_SubTest.__init__cCstd��dS)Nzsubtests cannot be run directly)r	)rr
r
rr��sz_SubTest.runTestcCs�g}|jtk	r.|jdj|j��|jrxdjdd�t|jj��D��}|jdj|��dj|�p�dS)Nz[{}]z, css'|]\}}dj||�VqdS)z{}={!r}N)rd)r;�kr{r
r
rr=�sz+_SubTest._subDescription.<locals>.<genexpr>z({})� z(<subtest>))rSrKrrdr�r�sortedr*)r�partsZparams_descr
r
r�_subDescription�s		z_SubTest._subDescriptioncCsdj|jj�|j��S)Nz{} {})rdr!r�rX)rr
r
rr��sz_SubTest.idcCs
|jj�S)N)r!r�)rr
r
rr��sz_SubTest.shortDescriptioncCsdj|j|j��S)Nz{} {})rdr!rX)rr
r
rr��sz_SubTest.__str__)	r
rrrr�rXr�r�r�r
r
)r�rr��sr�)0rr/rrIr�rrQrYr�r%rer�r�utilrrrrrZ
__unittest�objectrKrrLr	rrrr(r5r7r8rr:rBrKrOrPrbrq�
namedtupler�r�r�r�r�rLr�r
r
r
r�<module>sR(	(
/%5	,����: