Hacked By AnonymousFox

Current Path : /opt/alt/python36/lib64/python3.6/unittest/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/unittest/__pycache__/case.cpython-36.opt-2.pyc

3

 f]��@s�ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	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@seZdZdS)�SkipTestN)�__name__�
__module__�__qualname__�r
r
�)/opt/alt/python36/lib64/python3.6/case.pyr	sr	c@seZdZdS)�_ShouldStopN)r
rrr
r
r
rr"src@seZdZdS)�_UnexpectedSuccessN)r
rrr
r
r
rr'src@s&eZdZddd�Zejddd��ZdS)	�_OutcomeNcCs4d|_||_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
r.�Yn�tk
rh}z d|_|jj|t|�f�WYdd}~Xnjtk
rzYnXtj�}|j	r�||_
nd|_|jj||f�d}YnX|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)N)F)r
rrr�
contextlib�contextmanagerr$r
r
r
rr-s
	rcCs|S)Nr
)�objr
r
r�_idUsr(cs�fdd�}|S)Ncs4t|t�s$tj|��fdd��}|}d|_�|_|S)Ncst���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|rt|�StS)N)r5r()�	conditionr+r
r
r�skipIfhsr7cCs|st|�StS)N)r5r()r6r+r
r
r�
skipUnlesspsr8cCs
d|_|S)NT)�__unittest_expecting_failure__)r3r
r
rrxsrcs4t|t�r t�fdd�|D��St|t�o2t|��S)Nc3s|]}t|��VqdS)N)�_is_subtype)�.0r#)�basetyper
r�	<genexpr>~sz_is_subtype.<locals>.<genexpr>)r-�tuple�allr.�
issubclass)�expectedr<r
)r<rr:|s
r:c@seZdZdd�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�srBcCsdtjkrt|�StSdS)N�WITHIN_PYTHON_RPM_BUILD)�os�environr5r()r+r
r
r�_skipInRpmBuild�s
rKcstj���fdd��}|S)NcsNdtjkr@y�||�Wn tk
r8ttj���YnXt�n
�||�dS)NrH)rIrJ�	ExceptionZ_ExpectedFailurerr r)r)r*)�funcr
r�wrapper�s
z+_expectedFailureInRpmBuild.<locals>.wrapper)r/r0)rMrNr
)rMr�_expectedFailureInRpmBuild�srOc@seZdZddd�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__cCs�z�t|j|j�s"td||jf��|rD|ddkrDtjdtd�f}|sx|jdd�|_	|rttjdt
t|��td�|S|^}}y|j|_
Wntk
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)N)r
rrrrar
r
r
rrP�s

rPc@s$eZdZeZdZdd�Zdd�ZdS)�_AssertRaisesContextz-an exception type or tuple of exception typescCs|S)Nr
)rr
r
r�	__enter__�sz_AssertRaisesContext.__enter__c
Cs�|dkrby|jj}Wntk
r2t|j�}YnX|jrP|jdj||j��ql|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_tracebackZ	exceptionrS�search�pattern)r�exc_type�	exc_value�tb�exc_namerSr
r
r�__exit__�s(


z_AssertRaisesContext.__exit__N)r
rr�
BaseExceptionrVrXrcrnr
r
r
rrb�srbc@s$eZdZeZdZdd�Zdd�ZdS)�_AssertWarnsContextz(a warning type or tuple of warning typescCsRx$tjj�D]}t|dd�ri|_qWtjdd�|_|jj�|_tj	d|j
�|S)N�__warningregistry__T)�record�always)r�modules�values�getattrrqrY�catch_warnings�warnings_managerrc�simplefilterrA)r�vr
r
rrc	s
z_AssertWarnsContext.__enter__c
Cs|jj|||�|dk	rdSy|jj}Wntk
rFt|j�}YnXd}xd|jD]Z}|j}t||j�slqT|dkrx|}|j	dk	r�|j	j
t|��r�qT||_|j|_|j
|_
dSW|dk	r�|jdj|j	jt|���|jr�|jdj||j��n|jdj|��dS)Nz"{}" does not match "{}"z{} not triggered by {}z{} not triggered)rxrnrAr
r_rrY�messager-rSrhZwarning�filename�linenorGrdrirT)rrjrkrlrmZfirst_matching�m�wr
r
rrns8

z_AssertWarnsContext.__exit__N)r
rr�WarningrVrXrcrnr
r
r
rrpsrp�_LoggingWatcher�records�outputc@s$eZdZdd�Zdd�Zdd�ZdS)�_CapturingHandlercCstjj|�tgg�|_dS)N)�logging�Handlerrr��watcher)rr
r
rrAsz_CapturingHandler.__init__cCsdS)Nr
)rr
r
r�flushEsz_CapturingHandler.flushcCs*|jjj|�|j|�}|jjj|�dS)N)r�r�rrdr�)rrrrDr
r
r�emitHs
z_CapturingHandler.emitN)r
rrrr�r�r
r
r
rr�<sr�c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�_AssertLogsContextz"%(levelname)s:%(name)s:%(message)scCs:tj||�||_|r(tjj||�|_ntj|_d|_dS)N)	rBr�logger_namer�Z_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�ZLogger�loggerZ	getLoggerZ	Formatter�LOGGING_FORMATr�ZsetFormatterr��handlers�old_handlersr��	old_level�	propagate�
old_propagate�setLevel)rr��	formatterZhandlerr
r
rrc]s
z_AssertLogsContext.__enter__cCs`|j|j_|j|j_|jj|j�|dk	r.dSt|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�ZgetLevelNamer�r`)rrjrkrlr
r
rrnns

z_AssertLogsContext.__exit__N)r
rrr�rrcrnr
r
r
rr�Os	r�c@s�eZdZeZdZd�Zd�ZdZd�dd	�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'�Zejefd(d)��Zd*d+�Zd,d-�Zd.d/�Z d�d1d2�Z!d3d4�Z"d5d6�Z#d7d8�Z$d9d:�Z%d�d;d<�Z&d�d=d>�Z'd�d?d@�Z(dAdB�Z)dCdD�Z*dEdF�Z+d�dGdH�Z,dIdJ�Z-d�dKdL�Z.d�dMdN�Z/d�dOdP�Z0d�dQdR�Z1d�dSdT�Z2d�dUdV�Z3dWdX�Z4d�dYdZ�Z5d�d[d\�Z6d�d]d^�Z7d�d_d`�Z8d�dadb�Z9d�dcdd�Z:d�dedf�Z;d�dgdh�Z<d�didj�Z=d�dkdl�Z>d�dmdn�Z?d�dodp�Z@d�dqdr�ZAd�dsdt�ZBd�dudv�ZCd�dwdx�ZDd�dydz�ZEd�d{d|�ZFd�d}d~�ZGdd��ZHd�d��ZId�d�d��ZJd�d�d��ZKd�d��ZLeLe/�ZMZNeLe0�ZOZPeLe1�ZQZReLe2�ZSZTeLe(�ZUZVeLe*�ZWeLe'�ZXeLeH�ZYeLeJ�ZZeLeK�Z[d0S)��TestCaseT�P���F�runTestcCs�||_d|_d|_yt||�}Wn.tk
rN|dkrJtd|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�_testMethodDocrvr_�
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.countTestCasescCstj�S)N)rZ
TestResult)rr
r
r�defaultTestResult�szTestCase.defaultTestResultcCs |j}|r|jd�dj�pdS)N�
r)r��split�strip)r�docr
r
r�shortDescription�szTestCase.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__cCs<t|dd�}|dk	r |||�ntjdtd�|j|�dS)N�addSkipz4TestResult has no addSkip method, skips not reportedr�)rvrYrZ�RuntimeWarning�
addSuccess)rrr!r+r�r
r
r�_addSkipszTestCase._addSkipcks�|jdks|jjrdVdS|j}|dkr8tj|�}n|jj|�}t|||�|_zX|jj|jdd��dVWdQRX|jj	s�|jj
}|dk	r�|jr�t�n|jj
r�t�Wd||_XdS)NT)r")r�rr��collections�ChainMap�params�	new_child�_SubTestr$rrZfailfastrr)rrDr��parentZ
params_maprr
r
r�subTests$zTestCase.subTestcCsdx^|D]V\}}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._feedErrorsToResultcCsDy
|j}Wn*tk
r4tjdt�|j|�YnX|||�dS)Nz@TestResult has no addExpectedFailure method, reporting as passes)�addExpectedFailurer_rYrZr�r�)rrr r�r
r
r�_addExpectedFailureGs
zTestCase._addExpectedFailurecCshy
|j}WnPtk
rZtjdt�y
td�Wn$tk
rT|j|tj��YnXYn
X||�dS)NzCTestResult has no addUnexpectedSuccess method, reporting as failure)	�addUnexpectedSuccessr_rYrZr�rr�rr )rrr�r
r
r�_addUnexpectedSuccessQs

zTestCase._addUnexpectedSuccessNc
(Cs|}|dkr.|j�}t|dd�}|dk	r.|�|j|�t||j�}t|jdd�s^t|dd�r�z,t|jdd�pxt|dd�}|j|||�Wd|j|�XdSt|dd�}t|dd�}|p�|}t|�}	z�|	|_|	j	|��|j
�WdQRX|	j�r<||	_|	j	|dd��|�WdQRXd|	_|	j	|��|j
�WdQRX|j�x"|	jD]\}
}|j||
|��qLW|j||	j�|	j�r�|�r�|	j�r�|j||	j�n
|j|�n
|j|�|S|j|�|dk�r�t|d	d�}|dk	�r�|�|	jj�d|	_d|_XdS)
N�startTestRunr1Fr2�r9T)r"�stopTestRun)r�rvZ	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
CsN|jp
t�}x:|jrF|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__cCsJ|j�t||j��|j�x&|jrD|jjd�\}}}|||�q WdS)Nr���)r�rvr�r�r�r\)rr�r)r*r
r
r�debug�szTestCase.debugcCst|��dS)N)r	)rr+r
r
r�skipTest�szTestCase.skipTestcCs|j|��dS)N)rE)rrDr
r
r�fail�sz
TestCase.failcCs&|r"|j|dt|��}|j|��dS)Nz%s is not false)rCrrE)r�exprrDr
r
r�assertFalse�szTestCase.assertFalsecCs&|s"|j|dt|��}|j|��dS)Nz%s is not true)rCrrE)rr�rDr
r
r�
assertTrue�szTestCase.assertTruecCsP|js|p|S|dkr|Syd||fStk
rJdt|�t|�fSXdS)Nz%s : %s)�longMessage�UnicodeDecodeErrorr)rrDrFr
r
rrC�s
zTestCase._formatMessagec
Os$t||�}z|jd||�Sd}XdS)N�assertRaises)rbra)r�expected_exceptionr)r*�contextr
r
rr��s
zTestCase.assertRaisescOst||�}|jd||�S)N�assertWarns)rpra)r�expected_warningr)r*r�r
r
rr�s
zTestCase.assertWarnscCst|||�S)N)r�)rr�r�r
r
r�
assertLogs'szTestCase.assertLogscCsFt|�t|�kr@|jjt|��}|dk	r@t|t�r<t||�}|S|jS)N)r.r�r�r-rrv�_baseAssertEqual)r�first�secondZasserterr
r
r�_getAssertEqualityFunc=s

zTestCase._getAssertEqualityFunccCs0||ks,dt||�}|j||�}|j|��dS)Nz%s != %s)rrCrE)rr�r�rDrFr
r
rr�WszTestCase._baseAssertEqualcCs|j||�}||||d�dS)N)rD)r�)rr�r�rDZassertion_funcr
r
r�assertEqual^szTestCase.assertEqualcCs2||ks.|j|dt|�t|�f�}|j|��dS)Nz%s == %s)rCrrE)rr�r�rDr
r
r�assertNotEqualeszTestCase.assertNotEqualcCs�||krdS|dk	r$|dk	r$td��|dk	r\t||�|kr@dSdt|�t|�t|�f}n<|dkrhd}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	rtd��|dk	rZ||kr>t||�|kr>dSdt|�t|�t|�f}nF|dkrfd}||kr�tt||�|�dkr�dSdt|�t|�|f}|j||�}|j|��dS)Nz specify delta or places not bothz%s == %s within %s deltar�rz%s == %s within %r places)rWr�rr�rCrE)rr�r�r�rDr�rFr
r
r�assertNotAlmostEqual�s" zTestCase.assertNotAlmostEqualc'Cs�|dk	rP|j}t||�s.|jd|t|�f��t||�sT|jd|t|�f��nd}d}yt|�}Wn ttfk
r�d|}YnX|dkr�yt|�}Wn ttfk
r�d|}YnX|dk�r�||kr�dSd|j�ft||�}x�t	t
||��D]�}	y||	}
Wn.tttfk
�r8|d|	|f7}PYnXy||	}Wn.tttfk
�rt|d|	|f7}PYnX|
|kr�|d	|	ft|
|�7}Pq�W||k�r�|dk�r�t|�t|�k�r�dS||k�r0|d
|||f7}y|d|t||�f7}Wn,tttfk
�r,|d||f7}YnXnh||k�r�|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.assertSequenceEqualcCs2|j}|dkst|�|kr"||S|tt|�S)N)�maxDiffr��DIFF_OMITTED)rr{�diffZmax_diffr
r
rrszTestCase._truncateMessagecCs|j|||td�dS)N)r)rr�)rZlist1Zlist2rDr
r
rr� s
zTestCase.assertListEqualcCs|j|||td�dS)N)r)rr>)rZtuple1Ztuple2rDr
r
rr�,s	zTestCase.assertTupleEqualc
 Cshy|j|�}Wn^tk
r>}z|jd|�WYdd}~Xn0tk
rl}z|jd|�WYdd}~XnXy|j|�}Wn^tk
r�}z|jd|�WYdd}~Xn0tk
r�}z|jd|�WYdd}~XnX|p�|s�dSg}|�r|jd�x|D]}|jt|���qW|�rH|jd�x|D]}|jt|���q0Wdj|�}	|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�7s2
  




zTestCase.assertSetEqualcCs2||kr.dt|�t|�f}|j|j||��dS)Nz%s not found in %s)rr�rC)r�member�	containerrDrFr
r
r�assertInbszTestCase.assertIncCs2||kr.dt|�t|�f}|j|j||��dS)Nz%s unexpectedly found in %s)rr�rC)rrrrDrFr
r
r�assertNotIniszTestCase.assertNotIncCs2||k	r.dt|�t|�f}|j|j||��dS)Nz%s is not %s)rr�rC)r�expr1�expr2rDrFr
r
r�assertIspszTestCase.assertIscCs,||kr(dt|�f}|j|j||��dS)Nzunexpectedly identical: %s)rr�rC)rrrrDrFr
r
r�assertIsNotwszTestCase.assertIsNotcCs~|j|td�|j|td�||krzdt||�}ddjtjtj|�j�tj|�j���}|j	||�}|j
|j||��dS)Nz"First argument is not a dictionaryz#Second argument is not a dictionaryz%s != %sr�)�assertIsInstancer�rrrrrr	r
rr�rC)rZd1Zd2rDrFrr
r
rr�}s
zTestCase.assertDictEqualc	Cs�tjdt�g}g}xX|j�D]L\}}||kr:|j|�q|||kr|jdt|�t|�t||�f�qW|pt|szdSd}|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|�}}ytj|�}tj|�}Wntk
rHt||�}YnX||krVdSt||�}|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>�sz-TestCase.assertCountEqual.<locals>.<listcomp>r�)
r�r��CounterrWrrrrrCr�)
rr�r�rDZ	first_seqZ
second_seqZdifferencesrFrrr
r
r�assertCountEqual�s 



zTestCase.assertCountEqualcCs�|j|td�|j|td�||kr�t|�|jks@t|�|jkrN|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 stringT)�keependsrz
r�z%s != %sr�)rrr��_diffThresholdr�r
r�rrrrrr�rC)rr�r�rDZ
firstlinesZsecondlinesrFrr
r
rr��s

zTestCase.assertMultiLineEqualcCs2||ks.dt|�t|�f}|j|j||��dS)Nz%s not less than %s)rr�rC)r�a�brDrFr
r
r�
assertLess�szTestCase.assertLesscCs2||ks.dt|�t|�f}|j|j||��dS)Nz%s not less than or equal to %s)rr�rC)rr+r,rDrFr
r
r�assertLessEqual�szTestCase.assertLessEqualcCs2||ks.dt|�t|�f}|j|j||��dS)Nz%s not greater than %s)rr�rC)rr+r,rDrFr
r
r�
assertGreater�szTestCase.assertGreatercCs2||ks.dt|�t|�f}|j|j||��dS)Nz"%s not greater than or equal to %s)rr�rC)rr+r,rDrFr
r
r�assertGreaterEqual�szTestCase.assertGreaterEqualcCs,|dk	r(dt|�f}|j|j||��dS)Nz%s is not None)rr�rC)rr'rDrFr
r
r�assertIsNone�szTestCase.assertIsNonecCs"|dkrd}|j|j||��dS)Nzunexpectedly None)r�rC)rr'rDrFr
r
r�assertIsNotNone�szTestCase.assertIsNotNonecCs0t||�s,dt|�|f}|j|j||��dS)Nz%s is not an instance of %r)r-rr�rC)rr'r�rDrFr
r
rr�s
zTestCase.assertIsInstancecCs0t||�r,dt|�|f}|j|j||��dS)Nz%s is an instance of %r)r-rr�rC)rr'r�rDrFr
r
r�assertNotIsInstances
zTestCase.assertNotIsInstancecOst|||�}|jd||�S)N�assertRaisesRegex)rbra)rr�rSr)r*r�r
r
rr4s
zTestCase.assertRaisesRegexcOst|||�}|jd||�S)N�assertWarnsRegex)rpra)rr�rSr)r*r�r
r
rr5szTestCase.assertWarnsRegexcCsJt|ttf�rtj|�}|j|�sFd|j|f}|j||�}|j|��dS)Nz&Regex didn't match: %r not found in %r)	r-r�bytesrQrRrhrirCrE)r�textrSrDrFr
r
r�assertRegex/s

zTestCase.assertRegexcCs`t|ttf�rtj|�}|j|�}|r\d||j�|j��|j|f}|j	||�}|j
|��dS)Nz"Regex matched: %r matches %r in %r)r-rr6rQrRrh�start�endrirCrE)rr7Zunexpected_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_funcKs
z,TestCase._deprecate.<locals>.deprecated_funcr
)r=r>r
)r=r�
_deprecateJszTestCase._deprecatei�i)r�)N)N)N)N)NN)N)N)N)NNN)NNN)NN)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)\r
rr�AssertionErrorrEr�rr*Z_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�r�r�r�r�rrr�r�r�rrrrr�r%r(r�r-r.r/r0r1r2rr3r4r5r8r<r?ZfailUnlessEqualZassertEqualsZfailIfEqualZassertNotEqualsZfailUnlessAlmostEqualZassertAlmostEqualsZfailIfAlmostEqualZassertNotAlmostEqualsZ
failUnlessZassert_ZfailUnlessRaisesZfailIfZassertRaisesRegexpZassertRegexpMatchesZassertNotRegexpMatchesr
r
r
rr�{s�!
 	


E
	


!



	
'
 
c


+






!










	r�csfeZdZd�fdd�	Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Z�Z
S)�FunctionTestCaseNcs*tt|�j�||_||_||_||_dS)N)�superrCr�
_setUpFunc�
_tearDownFunc�	_testFunc�_description)rZtestFuncr�r��description)r�r
rris
zFunctionTestCase.__init__cCs|jdk	r|j�dS)N)rE)rr
r
rr�ps
zFunctionTestCase.setUpcCs|jdk	r|j�dS)N)rF)rr
r
rr�ts
zFunctionTestCase.tearDowncCs|j�dS)N)rG)rr
r
rr�xszFunctionTestCase.runTestcCs|jjS)N)rGr
)rr
r
rr�{szFunctionTestCase.idcCs@t||j�stS|j|jko>|j|jko>|j|jko>|j|jkS)N)r-r�r�rErFrGrH)rr�r
r
rr�~szFunctionTestCase.__eq__cCstt|�|j|j|j|jf�S)N)r�r.rErFrGrH)rr
r
rr��szFunctionTestCase.__hash__cCsdt|j�|jjfS)Nz%s (%s))rr�rGr
)rr
r
rr��s
zFunctionTestCase.__str__cCsdt|j�|jfS)Nz<%s tec=%s>)rr�rG)rr
r
rr��s
zFunctionTestCase.__repr__cCs2|jdk	r|jS|jj}|r.|jd�dj�p0dS)Nr�r)rHrGr�r�r�)rr�r
r
rr��s
z!FunctionTestCase.shortDescription)NNN)r
rrrr�r�r�r�r�r�r�r�r��
__classcell__r
r
)r�rrC`s		rCcsDeZdZ�fdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Z�Z	S)
r�cs(t�j�||_||_||_|j|_dS)N)rDr�_messager!r�rE)rr!r{r�)r�r
rr�s

z_SubTest.__init__cCstd��dS)Nzsubtests cannot be run directly)r)rr
r
rr��sz_SubTest.runTestcCsbg}|jtk	r |jdj|j��|jrTdjdd�t|jj��D��}|jdj|��dj|�p`dS)Nz[{}]z, css|]\}}dj||�VqdS)z{}={!r}N)rd)r;�krzr
r
rr=�sz+_SubTest._subDescription.<locals>.<genexpr>z({})� z(<subtest>))rKrBrrdr�r�sortedr!)r�partsZparams_descr
r
r�_subDescription�s
z_SubTest._subDescriptioncCsdj|jj�|j��S)Nz{} {})rdr!r�rP)rr
r
rr��sz_SubTest.idcCs
|jj�S)N)r!r�)rr
r
rr��sz_SubTest.shortDescriptioncCsdj|j|j��S)Nz{} {})rdr!rP)rr
r
rr��sz_SubTest.__str__)
r
rrrr�rPr�r�r�rJr
r
)r�rr��sr�)0rr/rrIr�rrQrYr�r%rer�r�utilrrrrrZ
__unittest�objectrBrrLr	rrrr(r5r7r8rr:rBrKrOrPrbrp�
namedtupler�r�r�r�r�rCr�r
r
r
r�<module>sZ(
/%5
,l:

Hacked By AnonymousFox1.0, Coded By AnonymousFox