AlkantarClanX12

Your IP : 3.145.37.219


Current Path : /lib64/python3.6/unittest/__pycache__/
Upload File :
Current File : //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#Gdd �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,Gd.d/�d/e,�Z-Gd0d1�d1e,�Z.dS)2�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
�%/usr/lib64/python3.6/unittest/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)NZWITHIN_PYTHON_RPM_BUILD)�os�environr5r()r+r
r
r�_skipInRpmBuild�s
rJc@seZdZddd�Zdd�ZdS)�_AssertRaisesBaseContextNcCs@tj||�||_||_|dk	r*tj|�}||_d|_d|_dS)N)	rBrrAr!�re�compile�expected_regex�obj_namerD)rrAr!rNr
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
rO�AttributeErrorr)r�namer)r*Zcallable_objr
r
r�handle�s.z_AssertRaisesBaseContext.handle)N)r
rrrr\r
r
r
rrK�s

rKc@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
rZrrOrG�format�	traceback�clear_framesr@�with_tracebackZ	exceptionrN�search�pattern)r�exc_type�	exc_value�tb�exc_namerNr
r
r�__exit__�s(


z_AssertRaisesContext.__exit__N)r
rr�
BaseExceptionrQrSr^rir
r
r
rr]�sr]c@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�getattrrlrT�catch_warnings�warnings_managerr^�simplefilterrA)r�vr
r
rr^�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)rsrirAr
rZrrT�messager-rNrcZwarning�filename�linenorGr_rdrO)rrerfrgrhZfirst_matching�m�wr
r
rri�s8

z_AssertWarnsContext.__exit__N)r
rr�WarningrQrSr^rir
r
r
rrk�srk�_LoggingWatcher�records�outputc@s$eZdZdd�Zdd�Zdd�ZdS)�_CapturingHandlercCstjj|�tgg�|_dS)N)�logging�Handlerrr|�watcher)rr
r
rr,sz_CapturingHandler.__init__cCsdS)Nr
)rr
r
r�flush0sz_CapturingHandler.flushcCs*|jjj|�|j|�}|jjj|�dS)N)r�r}rr_r~)rrmrDr
r
r�emit3s
z_CapturingHandler.emitN)r
rrrr�r�r
r
r
rr'src@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
rr?s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_FORMATrZsetFormatterr��handlers�old_handlersr��	old_level�	propagate�
old_propagate�setLevel)rr�Z	formatterZhandlerr
r
rr^Hs
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}rGr_r�ZgetLevelNamer�r[)rrerfrgr
r
rriYs

z_AssertLogsContext.__exit__N)r
rrr�rr^rir
r
r
rr�:s	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�_testMethodDocrqrZ�
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�id�szTestCase.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�)rqrTrU�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�subTest	s$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)�addExpectedFailurerZrTrUr�r�)rrr r�r
r
r�_addExpectedFailure2s
zTestCase._addExpectedFailurecCshy
|j}WnPtk
rZtjdt�y
td�Wn$tk
rT|j|tj��YnXYn
X||�dS)NzCTestResult has no addUnexpectedSuccess method, reporting as failure)	�addUnexpectedSuccessrZrTrUr�rr�rr )rrr�r
r
r�_addUnexpectedSuccess<s

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�rqZ	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�runKsh





zTestCase.runc
CsN|jp
t�}x:|jrF|jj�\}}}|j|��|||�WdQRXqW|jS)N)r�rr�rWr$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�rqr�r�r�rW)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)r]r\)r�expected_exceptionr)r*�contextr
r
rr��s
zTestCase.assertRaisescOst||�}|jd||�S)N�assertWarns)rkr\)r�expected_warningr)r*r�r
r
rr��s
zTestCase.assertWarnscCst|||�S)N)r�)rr�r�r
r
r�
assertLogsszTestCase.assertLogscCsFt|�t|�kr@|jjt|��}|dk	r@t|t�r<t||�}|S|jS)N)r.r�r�r-rrq�_baseAssertEqual)r�first�secondZasserterr
r
r�_getAssertEqualityFunc(s

zTestCase._getAssertEqualityFunccCs0||ks,dt||�}|j||�}|j|��dS)Nz%s != %s)rrCrE)rr�r�rDrFr
r
rr�BszTestCase._baseAssertEqualcCs|j||�}||||d�dS)N)rD)r�)rr�r�rDZassertion_funcr
r
r�assertEqualIszTestCase.assertEqualcCs2||ks.|j|dt|�t|�f�}|j|��dS)Nz%s == %s)rCrrE)rr�r�rDr
r
r�assertNotEqualPszTestCase.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)rR�absr�roundrCrE)rr�r��placesrD�deltarFr
r
r�assertAlmostEqualYs&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)rRr�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�rR�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)rrv�diffZmax_diffr
r
rrszTestCase._truncateMessagecCs|j|||td�dS)N)r)r	r�)rZlist1Zlist2rDr
r
rr�s
zTestCase.assertListEqualcCs|j|||td�dS)N)r)r	r>)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�)�
differencerRr�rZr�reprr�rC)
rZset1Zset2rDZdifference1r#Zdifference2�lines�itemrFr
r
rr�"s2
  




zTestCase.assertSetEqualcCs2||kr.dt|�t|�f}|j|j||��dS)Nz%s not found in %s)rr�rC)r�member�	containerrDrFr
r
r�assertInMszTestCase.assertIncCs2||kr.dt|�t|�f}|j|j||��dS)Nz%s unexpectedly found in %s)rr�rC)rrrrDrFr
r
r�assertNotInTszTestCase.assertNotIncCs2||k	r.dt|�t|�f}|j|j||��dS)Nz%s is not %s)rr�rC)r�expr1�expr2rDrFr
r
r�assertIs[szTestCase.assertIscCs,||kr(dt|�f}|j|j||��dS)Nzunexpectedly identical: %s)rr�rC)rrrrDrFr
r
r�assertIsNotbszTestCase.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�rr�rrrrrrr�rC)rZd1Zd2rDrFrr
r
rr�hs
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;ryr
r
rr=�sz4TestCase.assertDictContainsSubset.<locals>.<genexpr>z; zMismatched values: %s)	rTrUrV�itemsrrr�r�rC)	rZsubsetZ
dictionaryrDZmissingZ
mismatched�key�valuerFr
r
r�assertDictContainsSubsetts,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;rr
r
r�
<listcomp>�sz-TestCase.assertCountEqual.<locals>.<listcomp>r�)
r�r��CounterrRrrr�rrCr�)
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�rr�rr�rrrr�rC)rr�r�rDZ
firstlinesZsecondlinesrFrr
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�assertNotIsInstance�s
zTestCase.assertNotIsInstancecOst|||�}|jd||�S)N�assertRaisesRegex)r]r\)rr�rNr)r*r�r
r
rr-�s
zTestCase.assertRaisesRegexcOst|||�}|jd||�S)N�assertWarnsRegex)rkr\)rr�rNr)r*r�r
r
rr.szTestCase.assertWarnsRegexcCsJt|ttf�rtj|�}|j|�sFd|j|f}|j||�}|j|��dS)Nz&Regex didn't match: %r not found in %r)	r-r�bytesrLrMrcrdrCrE)r�textrNrDrFr
r
r�assertRegexs

zTestCase.assertRegexcCs`t|ttf�rtj|�}|j|�}|r\d||j�|j��|j|f}|j	||�}|j
|��dS)Nz"Regex matched: %r matches %r in %r)r-rr/rLrMrc�start�endrdrCrE)rr0Zunexpected_regexrD�matchrFr
r
r�assertNotRegex&s

zTestCase.assertNotRegexcs�fdd�}|S)Ncs tjdj�j�td��||�S)NzPlease use {0} instead.r�)rTrUr_r
rV)r)r*)�
original_funcr
r�deprecated_func6s
z,TestCase._deprecate.<locals>.deprecated_funcr
)r6r7r
)r6r�
_deprecate5s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�r
r#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�r	rr�r�r�rrrrr�rr!r�r&r'r(r)r*r+rr,r-r.r1r5r8ZfailUnlessEqualZassertEqualsZfailIfEqualZassertNotEqualsZfailUnlessAlmostEqualZassertAlmostEqualsZfailIfAlmostEqualZassertNotAlmostEqualsZ
failUnlessZassert_ZfailUnlessRaisesZfailIfZassertRaisesRegexpZassertRegexpMatchesZassertNotRegexpMatchesr
r
r
rr�fs�!
 	


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)�superr<r�
_setUpFunc�
_tearDownFunc�	_testFunc�_description)rZtestFuncr�r�Zdescription)r�r
rrTs
zFunctionTestCase.__init__cCs|jdk	r|j�dS)N)r>)rr
r
rr�[s
zFunctionTestCase.setUpcCs|jdk	r|j�dS)N)r?)rr
r
rr�_s
zFunctionTestCase.tearDowncCs|j�dS)N)r@)rr
r
rr�cszFunctionTestCase.runTestcCs|jjS)N)r@r
)rr
r
rr�fszFunctionTestCase.idcCs@t||j�stS|j|jko>|j|jko>|j|jko>|j|jkS)N)r-r�r�r>r?r@rA)rr�r
r
rr�iszFunctionTestCase.__eq__cCstt|�|j|j|j|jf�S)N)r�r.r>r?r@rA)rr
r
rr�rszFunctionTestCase.__hash__cCsdt|j�|jjfS)Nz%s (%s))rr�r@r
)rr
r
rr�vs
zFunctionTestCase.__str__cCsdt|j�|jfS)Nz<%s tec=%s>)rr�r@)rr
r
rr�zs
zFunctionTestCase.__repr__cCs2|jdk	r|jS|jj}|r.|jd�dj�p0dS)Nr�r)rAr@r�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�rr<Ks		r<csDeZdZ�fdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Z�Z	S)
r�cs(t�j�||_||_||_|j|_dS)N)r=r�_messager!r�rE)rr!rvr�)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)r_)r;�krur
r
rr=�sz+_SubTest._subDescription.<locals>.<genexpr>z({})� z(<subtest>))rCr;rr_r�r��sortedr)r�partsZparams_descr
r
r�_subDescription�s
z_SubTest._subDescriptioncCsdj|jj�|j��S)Nz{} {})r_r!r�rH)rr
r
rr��sz_SubTest.idcCs
|jj�S)N)r!r�)rr
r
rr��sz_SubTest.shortDescriptioncCsdj|j|j��S)Nz{} {})r_r!rH)rr
r
rr��sz_SubTest.__str__)
r
rrrr�rHr�r�r�rBr
r
)r�rr��sr�)/rr/rrHr�rrLrTr�r%r`r�r�utilrrrrrZ
__unittest�objectr;r�	Exceptionr	rrrr(r5r7r8rr:rBrJrKr]rk�
namedtupler|r�rr�r�r<r�r
r
r
r�<module>sX(
/%5
,l: