Your IP : 18.118.24.176


Current Path : /opt/alt/python39/lib64/python3.9/unittest/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/unittest/__pycache__/case.cpython-39.opt-2.pyc

a

R�fC��@s�ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZddlm
Z
mZmZmZmZdZe�ZdZGdd�de�ZGd	d
�d
e�ZGdd�de�ZGd
d�de�Zdd�ZgZdd�Zdd�Zdd�Zdd�Z dd�Z!dd�Z"dd�Z#Gdd �d �Z$Gd!d"�d"e$�Z%Gd#d$�d$e%�Z&Gd%d&�d&e%�Z'Gd'd(�d(ej(�Z)Gd)d*�d*e�Z*Gd+d,�d,e*�Z+Gd-d.�d.e*�Z,dS)/�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__�rr�2/opt/alt/python39/lib64/python3.9/unittest/case.pyr	sr	c@seZdZdS)�_ShouldStopNr
rrrrr!src@seZdZdS)�_UnexpectedSuccessNr
rrrrr&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)�selfrrrr�__init__-sz_Outcome.__init__Fc
cs�|j}d|_z�z
dVWn�ty,�Yn�tyh}z&d|_|j�|t|�f�WYd}~npd}~0tyxYnXt��}|j	r�||_
nd|_|j�||f�d}Yn0|jr�|jr�|j�|df�W|jo�||_n|jo�||_0dS)NTF)
r�KeyboardInterruptr	r�append�strr�sys�exc_inforrrr)r�	test_case�isTestZold_success�er!rrr�testPartExecutor6s*
(
z_Outcome.testPartExecutor)N)F)rrr
r�
contextlib�contextmanagerr%rrrrr,s
	rcCs|S�Nr)�objrrr�_idTsr*cOst�|||f�dSr()�_module_cleanupsr)�function�args�kwargsrrr�addModuleCleanupYsr/c
Csjg}trZt��\}}}z||i|��WqtyV}z|�|�WYd}~qd}~00q|rf|d�dS�Nr)r+�pop�	Exceptionr)�
exceptionsr,r-r.�excrrr�doModuleCleanups_s"r5cs,�fdd�}t�tj�r(�}d�||�S|S)Ncs4t|t�s$t�|��fdd��}|}d|_�|_|S)Ncst���dSr(�r	�r-r.��reasonrr�skip_wrapperusz-skip.<locals>.decorator.<locals>.skip_wrapperT)�
isinstance�type�	functools�wraps�__unittest_skip__�__unittest_skip_why__)�	test_itemr:r8rr�	decoratorss
zskip.<locals>.decorator�)r;�types�FunctionType)r9rBrArr8r�skipos
rFcCs|rt|�StSr(�rFr*�Z	conditionr9rrr�skipIf�srIcCs|st|�StSr(rGrHrrr�
skipUnless�srJcCs
d|_|S)NT)�__unittest_expecting_failure__)rArrrr�srcs4t|t�r t�fdd�|D��St|t�o2t|��S)Nc3s|]}t|��VqdSr()�_is_subtype)�.0r$��basetyperr�	<genexpr>��z_is_subtype.<locals>.<genexpr>)r;�tuple�allr<�
issubclass)�expectedrOrrNrrL�s
rLc@seZdZdd�Zdd�ZdS)�_BaseTestCaseContextcCs
||_dSr()r")rr"rrrr�sz_BaseTestCaseContext.__init__cCs |j�|j|�}|j�|��dSr()r"�_formatMessage�msg�failureException)r�standardMsgrXrrr�
_raiseFailure�sz"_BaseTestCaseContext._raiseFailureN)rrr
rr[rrrrrV�srVc@seZdZddd�Zdd�ZdS)�_AssertRaisesBaseContextNcCs@t�||�||_||_|dur*t�|�}||_d|_d|_dSr()	rVrrUr"�re�compile�expected_regex�obj_namerX)rrUr"r_rrrr�s
z!_AssertRaisesBaseContext.__init__cCs�z�t|j|j�s"td||jf��|sX|�dd�|_|rNtdtt|��f��|Wd}S|^}}z|j	|_
Wnty�t|�|_
Yn0|�||i|��Wd�n1s�0YWd}nd}0dS)Nz%s() arg 1 must be %srXz3%r is an invalid keyword argument for this function)
rLrU�
_base_type�	TypeError�_base_type_strr1rX�next�iterrr`�AttributeErrorr)r�namer-r.Zcallable_objrrr�handle�s,���.z_AssertRaisesBaseContext.handle)N)rrr
rrhrrrrr\�s

r\c@s.eZdZeZdZdd�Zdd�Zee	j
�ZdS)�_AssertRaisesContextz-an exception type or tuple of exception typescCs|Sr(r�rrrr�	__enter__�sz_AssertRaisesContext.__enter__cCs�|dur`z|jj}Wnty0t|j�}Yn0|jrN|�d�||j��qj|�d�|��n
t�|�t	||j�szdS|�
d�|_|jdur�dS|j}|�
t|��s�|�d�|jt|���dS)Nz{} not raised by {}z
{} not raisedFT�"{}" does not match "{}")rUrrfrr`r[�format�	traceback�clear_framesrT�with_tracebackZ	exceptionr_�search�pattern)r�exc_type�	exc_value�tb�exc_namer_rrr�__exit__�s,
�


�z_AssertRaisesContext.__exit__N)rrr
�
BaseExceptionrarcrkrw�classmethodrD�GenericAlias�__class_getitem__rrrrri�s
ric@s$eZdZeZdZdd�Zdd�ZdS)�_AssertWarnsContextz(a warning type or tuple of warning typescCsRttj���D]}t|dd�ri|_qtjdd�|_|j�	�|_t�
d|j�|S)N�__warningregistry__T)�record�always)�listr �modules�values�getattrr}�warnings�catch_warnings�warnings_managerrk�simplefilterrU)r�vrrrrk�sz_AssertWarnsContext.__enter__cCs�|j�|||�|durdSz|jj}WntyDt|j�}Yn0d}|jD]Z}|j}t||j�shqP|durt|}|j	dur�|j	�
t|��s�qP||_|j|_|j
|_
dS|dur�|�d�|j	jt|���|jr�|�d�||j��n|�d�|��dS)Nrlz{} not triggered by {}z{} not triggered)r�rwrUrrfrr��messager;r_rqZwarning�filename�linenor[rmrrr`)rrsrtrurvZfirst_matching�m�wrrrrws>

��
�z_AssertWarnsContext.__exit__N)rrr
�Warningrarcrkrwrrrrr|�sr|c@seZdZdd�ZdS)�_OrderedChainMapccs8t�}|jD]&}|D]}||vr|�|�|VqqdSr()�set�maps�add)r�seen�mapping�krrr�__iter__,s

z_OrderedChainMap.__iter__N)rrr
r�rrrrr�+sr�c@seZdZeZdZdZdZdZgZ	d�dd�Z
dd	�Zd
d�Ze
dd
��Zdd�Zdd�Ze
dd��Ze
dd��Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zejefd(d)��Zd*d+�Z d,d-�Z!d.d/�Z"d0d1�Z#d2d3�Z$d4d5�Z%d6d7�Z&d�d9d:�Z'd;d<�Z(e
d=d>��Z)d?d@�Z*dAdB�Z+dCdD�Z,d�dEdF�Z-d�dGdH�Z.d�dIdJ�Z/dKdL�Z0dMdN�Z1dOdP�Z2d�dQdR�Z3dSdT�Z4d�dUdV�Z5d�dWdX�Z6d�dYdZ�Z7d�d[d\�Z8d�d]d^�Z9d�d_d`�Z:dadb�Z;d�dcdd�Z<d�dedf�Z=d�dgdh�Z>d�didj�Z?d�dkdl�Z@d�dmdn�ZAd�dodp�ZBd�dqdr�ZCd�dsdt�ZDd�dudv�ZEd�dwdx�ZFd�dydz�ZGd�d{d|�ZHd�d}d~�ZId�dd��ZJd�d�d��ZKd�d�d��ZLd�d�d��ZMd�d�d��ZNd�d��ZOd�d��ZPd�d�d��ZQd�d�d��ZRd�d��ZSeSe6�ZTZUeSe7�ZVZWeSe8�ZXZYeSe9�ZZZ[eSe/�Z\Z]eSe1�Z^eSe.�Z_eSeO�Z`eSeQ�ZaeSeR�Zbd8S)��TestCaseTi�iF�runTestcCs�||_d|_d|_zt||�}Wn,tyL|dkrHtd|j|f��Yn
0|j|_g|_d|_	i|_
|�td�|�t
d�|�td�|�td�|�td�|�td�dS)	NzNo testr�zno such test method in %s: %s�assertDictEqual�assertListEqual�assertTupleEqual�assertSetEqual�assertMultiLineEqual)�_testMethodName�_outcome�_testMethodDocr�rf�
ValueError�	__class__�__doc__�	_cleanups�_subtest�_type_equality_funcs�addTypeEqualityFunc�dictr�rRr��	frozensetr)rZ
methodName�
testMethodrrrrfs(�zTestCase.__init__cCs||j|<dSr()r�)rZtypeobjr,rrrr��s
zTestCase.addTypeEqualityFunccOs|j�|||f�dSr()r�r�rr,r-r.rrr�
addCleanup�szTestCase.addCleanupcOs|j�|||f�dSr()�_class_cleanupsr��clsr,r-r.rrr�addClassCleanup�szTestCase.addClassCleanupcCsdSr(rrjrrr�setUp�szTestCase.setUpcCsdSr(rrjrrr�tearDown�szTestCase.tearDowncCsdSr(r�r�rrr�
setUpClass�szTestCase.setUpClasscCsdSr(rr�rrr�
tearDownClass�szTestCase.tearDownClasscCsdS)Nrrrjrrr�countTestCases�szTestCase.countTestCasescCst��Sr()rZ
TestResultrjrrr�defaultTestResult�szTestCase.defaultTestResultcCs$|j}|r |���d�d��SdS�N�
r)r��strip�split�r�docrrr�shortDescription�szTestCase.shortDescriptioncCsdt|j�|jfS)Nz%s.%s�rr�r�rjrrr�id�szTestCase.idcCs t|�t|�urtS|j|jkSr()r<�NotImplementedr��r�otherrrr�__eq__�szTestCase.__eq__cCstt|�|jf�Sr()�hashr<r�rjrrr�__hash__�szTestCase.__hash__cCsd|jt|j�fS�Nz%s (%s))r�rr�rjrrr�__str__�szTestCase.__str__cCsdt|j�|jfS)Nz<%s testMethod=%s>r�rjrrr�__repr__�s�zTestCase.__repr__cCs<t|dd�}|dur |||�nt�dtd�|�|�dS)N�addSkipz4TestResult has no addSkip method, skips not reported�)r�r��warn�RuntimeWarning�
addSuccess)rrr"r9r�rrr�_addSkip�s�zTestCase._addSkipcks�|jdus|jjsdVdS|j}|dur4t|�}n|j�|�}t|||�|_zr|jj|jdd��dVWd�n1s~0Y|jjs�|jj	}|dur�|j
r�t�n|jjr�t�W||_n||_0dS)NT�r#)
r�rr�r��params�	new_child�_SubTestr%rrZfailfastrr)rrXr��parentZ
params_maprrrr�subTest�s$
$zTestCase.subTestcCs`|D]V\}}t|t�r(|�|j||�q|durt|d|j�rN|�||�q|�||�qdSr0)r;r�rr"rTrY�
addFailureZaddError)rrr�testr!rrr�_feedErrorsToResult�s
zTestCase._feedErrorsToResultcCsBz
|j}Wn(ty2t�dt�|�|�Yn0|||�dS)Nz@TestResult has no addExpectedFailure method, reporting as passes)�addExpectedFailurerfr�r�r�r�)rrr!r�rrr�_addExpectedFailure	s
�zTestCase._addExpectedFailurecCsdz
|j}WnLtyVt�dt�z
td�Wn"tyP|�|t���Yn0Yn
0||�dS)NzCTestResult has no addUnexpectedSuccess method, reporting as failure)	�addUnexpectedSuccessrfr�r�r�rr�r r!)rrr�rrr�_addUnexpectedSuccesss
�
zTestCase._addUnexpectedSuccesscCs|��dSr()r�rjrrr�
_callSetUp"szTestCase._callSetUpcCs
|�dSr(r)r�methodrrr�_callTestMethod%szTestCase._callTestMethodcCs|��dSr()r�rjrrr�
_callTearDown(szTestCase._callTearDowncOs||i|��dSr(rr�rrr�_callCleanup+szTestCase._callCleanupNc
	Cs�|dur8|��}t|dd�}t|dd�}|dur<|�nd}|�|��z,t||j�}t|jdd�spt|dd�r�t|jdd�p�t|dd�}|�|||�|W|�|�|dur�|�St|dd�p�t|dd�}t|�}�zf||_|�	|��|�
�Wd�n1�s
0Y|j�r�||_|j	|dd	��|�
|�Wd�n1�sR0Yd|_|�	|��|��Wd�n1�s�0Y|��|jD]\}}	|�|||	��q�|�||j�|j�r|�r�|j�r�|�||j�n
|�|�n
|�|�|W|j��d|_d|_W|�|�|du�r>|�S|j��d|_d|_0W|�|�|du�r�|�n|�|�|du�r�|�0dS)
N�startTestRun�stopTestRunr?Fr@rCrKTr�)r�r�Z	startTestr�r�r�ZstopTestrr�r%r�rrr�r��
doCleanupsrr�rrr�r�r��clear)
rrr�r�r��skip_whyr�outcomer�r9rrr�run.s�

�
�,
�
�(*(

�

��



�

zTestCase.runcCsl|jp
t�}|jrf|j��\}}}|�|��(|j|g|�Ri|��Wd�q1sZ0Yq|jSr()r�rr�r1r%r�r)rr�r,r-r.rrrr�qs8zTestCase.doCleanupscCsXg|_|jrT|j��\}}}z||i|��WqtyP|j�t���Yq0qdSr()ZtearDown_exceptionsr�r1r2rr r!r�rrr�doClassCleanups~szTestCase.doClassCleanupscOs|j|i|��Sr()r�)rr-�kwdsrrr�__call__�szTestCase.__call__cCs�t||j�}t|jdd�s&t|dd�rHt|jdd�p>t|dd�}t|��|��|�|�|��|jr�|j��\}}}|j	|g|�Ri|��qbdS)Nr?Fr@rC)
r�r�r�r	r�r�r�r�r1r�)rr�r�r,r-r.rrr�debug�s
�
�
zTestCase.debugcCst|��dSr(r6)rr9rrr�skipTest�szTestCase.skipTestcCs|�|��dSr()rY)rrXrrr�fail�sz
TestCase.failcCs&|r"|�|dt|��}|�|��dS)Nz%s is not false�rWrrY�r�exprrXrrr�assertFalse�szTestCase.assertFalsecCs&|s"|�|dt|��}|�|��dS)Nz%s is not truer�r�rrr�
assertTrue�szTestCase.assertTruecCsT|js|p|S|dur|Szd||fWStyNdt|�t|�fYS0dS)Nz%s : %s)�longMessage�UnicodeDecodeErrorr)rrXrZrrrrW�s
zTestCase._formatMessagecOs*t||�}z|�d||�Wd}Sd}0dS)N�assertRaises�rirh)r�expected_exceptionr-r.�contextrrrr��s
�zTestCase.assertRaisescOst||�}|�d||�S)N�assertWarns�r|rh)r�expected_warningr-r.r�rrrr��s
zTestCase.assertWarnscCsddlm}||||�S)Nr)�_AssertLogsContext)Z_logr�)rZlogger�levelr�rrr�
assertLogsszTestCase.assertLogscCsFt|�t|�ur@|j�t|��}|dur@t|t�r<t||�}|S|jSr()r<r��getr;rr��_baseAssertEqual)r�first�secondZasserterrrr�_getAssertEqualityFuncs

zTestCase._getAssertEqualityFunccCs0||ks,dt||�}|�||�}|�|��dS)N�%s != %s)rrWrY)rrrrXrZrrrr9szTestCase._baseAssertEqualcCs|�||�}||||d�dS)N)rX)r)rrrrXZassertion_funcrrr�assertEqual@szTestCase.assertEqualcCs2||ks.|�|dt|�t|�f�}|�|��dS)Nz%s == %sr�)rrrrXrrr�assertNotEqualGs
�zTestCase.assertNotEqualcCs�||krdS|dur$|dur$td��t||�}|durf||krDdSdt|�t|�t|�t|�f}n:|durrd}t||�dkr�dSdt|�t|�|t|�f}|�||�}|�|��dS)N� specify delta or places not bothz(%s != %s within %s delta (%s difference)�rz)%s != %s within %r places (%s difference)�rb�absr�roundrWrY�rrrZplacesrXZdelta�diffrZrrr�assertAlmostEqualPs4��zTestCase.assertAlmostEqualcCs�|dur|durtd��t||�}|durb||ks@||kr@dSdt|�t|�t|�t|�f}n<|durnd}||ks�t||�dkr�dSdt|�t|�|f}|�||�}|�|��dS)Nrz(%s == %s within %s delta (%s difference)r	rz%s == %s within %r placesr
r
rrr�assertNotAlmostEqual}s,��zTestCase.assertNotAlmostEqualcCs�|durP|j}t||�s.|�d|t|�f��t||�sT|�d|t|�f��nd}d}zt|�}Wnttfy�d|}Yn0|dur�zt|�}Wnttfy�d|}Yn0|du�r�||kr�dSd|��ft||�}t	t
||��D]�}	z||	}
Wn2tttf�y6|d|	|f7}Y�q�Yn0z||	}Wn2tttf�yv|d|	|f7}Y�q�Yn0|
|kr�|d	|	ft|
|�7}�q�q�||k�r�|du�r�t|�t|�k�r�dS||k�r2|d
|||f7}z|d|t||�f7}Wn*tttf�y.|d||f7}Yn0nf||k�r�|d
|||f7}z|d|t||�f7}Wn*tttf�y�|d||f7}Yn0|}dd�
t�t�|���t�|�����}
|�||
�}|�||�}|�|�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�)rr;rYr�lenrb�NotImplementedError�
capitalizer�range�min�
IndexErrorr<�join�difflib�ndiff�pprint�pformat�
splitlines�_truncateMessagerWr�)rZseq1Zseq2rX�seq_typeZ
seq_type_nameZ	differingZlen1Zlen2�iZitem1Zitem2rZ�diffMsgrrr�assertSequenceEqual�s�

�

��
�

������

��
�

��
���zTestCase.assertSequenceEqualcCs2|j}|dust|�|kr"||S|tt|�Sr()�maxDiffr�DIFF_OMITTED)rr�rZmax_diffrrrrszTestCase._truncateMessagecCs|j|||td�dS�N)r)r!r�)rZlist1Zlist2rXrrrr�	s
zTestCase.assertListEqualcCs|j|||td�dSr$)r!rR)rZtuple1Ztuple2rXrrrr�s	zTestCase.assertTupleEqualc

Cshz|�|�}Wnbty@}z|�d|�WYd}~n:d}~0typ}z|�d|�WYd}~n
d}~00z|�|�}Wnbty�}z|�d|�WYd}~n:d}~0ty�}z|�d|�WYd}~n
d}~00|s�|s�dSg}|�r|�d�|D]}|�t|���q|�rH|�d�|D]}|�t|���q2d�|�}	|�|�||	��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�)�
differencerbr�rfr�reprrrW)
rZset1Zset2rXZdifference1r$Zdifference2�lines�itemrZrrrr� s2
"$"$


zTestCase.assertSetEqualcCs2||vr.dt|�t|�f}|�|�||��dS)Nz%s not found in %s�rr�rW�r�memberZ	containerrXrZrrr�assertInKs
�zTestCase.assertIncCs2||vr.dt|�t|�f}|�|�||��dS)Nz%s unexpectedly found in %sr)r*rrr�assertNotInRs
�zTestCase.assertNotIncCs2||ur.dt|�t|�f}|�|�||��dS)Nz%s is not %sr)�rZexpr1Zexpr2rXrZrrr�assertIsYs
�zTestCase.assertIscCs,||ur(dt|�f}|�|�||��dS)Nzunexpectedly identical: %sr)r.rrr�assertIsNot`szTestCase.assertIsNotc	Cs~|�|td�|�|td�||krzdt||�}dd�t�t�|���t�|�����}|�	||�}|�
|�||��dS)Nz"First argument is not a dictionaryz#Second argument is not a dictionaryrr�)�assertIsInstancer�rrrrrrrrr�rW)rZd1Zd2rXrZrrrrr�fs
�zTestCase.assertDictEqualc		Cs�t�dt�g}g}|��D]L\}}||vr8|�|�q|||kr|�dt|�t|�t||�f�q|sv|svdSd}|r�dd�dd�|D��}|r�|r�|d7}|d	d�|�7}|�|�||��dS)
Nz&assertDictContainsSubset is deprecatedz%s, expected: %s, actual: %srCzMissing: %s�,css|]}t|�VqdSr()r)rMr�rrrrP�rQz4TestCase.assertDictContainsSubset.<locals>.<genexpr>z; zMismatched values: %s)	r�r��DeprecationWarning�itemsrrrr�rW)	rZsubsetZ
dictionaryrXZmissingZ
mismatched�key�valuerZrrr�assertDictContainsSubsetrs4�
���
z!TestCase.assertDictContainsSubsetc
Cs�t|�t|�}}zt�|�}t�|�}WntyFt||�}Yn0||krTdSt||�}|r�d}dd�|D�}d�|�}	|�||	�}|�||�}|�	|�dS)NzElement counts were not equal:
cSsg|]}d|�qS)z First has %d, Second has %d:  %rr)rMrrrr�
<listcomp>�rQz-TestCase.assertCountEqual.<locals>.<listcomp>r�)
r��collections�CounterrbrrrrrWr�)
rrrrXZ	first_seqZ
second_seqZdifferencesrZr'r rrr�assertCountEqual�s 


zTestCase.assertCountEqualcCs�|�|td�|�|td�||kr�t|�|jks@t|�|jkrN|�|||�|jdd�}|jdd�}t|�dkr�|�d�|kr�|dg}|dg}dt||�}dd	�t	�
||��}|�||�}|�|�
||��dS)
NzFirst argument is not a stringzSecond argument is not a stringT)�keependsrz
r�rrC)r1rr�_diffThresholdrrr�rrrrrr�rW)rrrrXZ
firstlinesZsecondlinesrZrrrrr��s �

zTestCase.assertMultiLineEqualcCs2||ks.dt|�t|�f}|�|�||��dS)Nz%s not less than %sr)�r�a�brXrZrrr�
assertLess�szTestCase.assertLesscCs2||ks.dt|�t|�f}|�|�||��dS)Nz%s not less than or equal to %sr)r>rrr�assertLessEqual�szTestCase.assertLessEqualcCs2||ks.dt|�t|�f}|�|�||��dS)Nz%s not greater than %sr)r>rrr�
assertGreater�szTestCase.assertGreatercCs2||ks.dt|�t|�f}|�|�||��dS)Nz"%s not greater than or equal to %sr)r>rrr�assertGreaterEqual�szTestCase.assertGreaterEqualcCs,|dur(dt|�f}|�|�||��dS)Nz%s is not Noner)�rr)rXrZrrr�assertIsNone�szTestCase.assertIsNonecCs"|durd}|�|�||��dS)Nzunexpectedly None)r�rWrErrr�assertIsNotNone�szTestCase.assertIsNotNonecCs0t||�s,dt|�|f}|�|�||��dS)Nz%s is not an instance of %r�r;rr�rW�rr)r�rXrZrrrr1�s
zTestCase.assertIsInstancecCs0t||�r,dt|�|f}|�|�||��dS)Nz%s is an instance of %rrHrIrrr�assertNotIsInstance�s
zTestCase.assertNotIsInstancecOst|||�}|�d||�S)N�assertRaisesRegexr�)rr�r_r-r.r�rrrrK�s
zTestCase.assertRaisesRegexcOst|||�}|�d||�S)N�assertWarnsRegexr�)rr�r_r-r.r�rrrrLszTestCase.assertWarnsRegexcCsJt|ttf�rt�|�}|�|�sFd|j|f}|�||�}|�|��dS)Nz&Regex didn't match: %r not found in %r)	r;r�bytesr]r^rqrrrWrY)r�textr_rXrZrrr�assertRegexs

�zTestCase.assertRegexcCs`t|ttf�rt�|�}|�|�}|r\d||��|���|j|f}|�	||�}|�
|��dS)Nz"Regex matched: %r matches %r in %r)r;rrMr]r^rq�start�endrrrWrY)rrNZunexpected_regexrX�matchrZrrr�assertNotRegex#s

�zTestCase.assertNotRegexcs�fdd�}|S)Ncs$t�d��j�td��|i|��S)NzPlease use {0} instead.r�)r�r�rmrr3r7��
original_funcrr�deprecated_func3s

�z,TestCase._deprecate.<locals>.deprecated_funcr)rUrVrrTr�
_deprecate2szTestCase._deprecate)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)crrr
�AssertionErrorrYr�r"r=Z_classSetupFailedr�rr�r�ryr�r�r�r�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�r�r�r�r�r�rWr�r�r�rrrrrrr!rr�r�r�r,r-r/r0r�r7r;r�rArBrCrDrFrGr1rJrKrLrOrSrWZfailUnlessEqualZassertEqualsZfailIfEqualZassertNotEqualsZfailUnlessAlmostEqualZassertAlmostEqualsZfailIfAlmostEqualZassertNotAlmostEqualsZ
failUnlessZassert_ZfailUnlessRaisesZfailIfZassertRaisesRegexpZassertRegexpMatchesZassertNotRegexpMatchesrrrrr�5s�!
 


	


C




!



	�
-�
#
c


+






 










	r�csfeZdZd�fdd�	Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Z�Z
S)�FunctionTestCaseNcs*tt|���||_||_||_||_dSr()�superrZr�
_setUpFunc�
_tearDownFunc�	_testFunc�_description)rZtestFuncr�r�Zdescription�r�rrrQs
zFunctionTestCase.__init__cCs|jdur|��dSr()r\rjrrrr�Xs
zFunctionTestCase.setUpcCs|jdur|��dSr()r]rjrrrr�\s
zFunctionTestCase.tearDowncCs|��dSr()r^rjrrrr�`szFunctionTestCase.runTestcCs|jjSr()r^rrjrrrr�cszFunctionTestCase.idcCs@t||j�stS|j|jko>|j|jko>|j|jko>|j|jkSr()r;r�r�r\r]r^r_r�rrrr�fs
�
�
�zFunctionTestCase.__eq__cCstt|�|j|j|j|jf�Sr()r�r<r\r]r^r_rjrrrr�os�zFunctionTestCase.__hash__cCsdt|j�|jjfSr�)rr�r^rrjrrrr�ss
�zFunctionTestCase.__str__cCsdt|j�|jfS)Nz<%s tec=%s>)rr�r^rjrrrr�ws
�zFunctionTestCase.__repr__cCs2|jdur|jS|jj}|r.|�d�d��p0dSr�)r_r^r�r�r�r�rrrr�{s
z!FunctionTestCase.shortDescription)NNN)rrr
rr�r�r�r�r�r�r�r�r��
__classcell__rrr`rrZHs		rZcsDeZdZ�fdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Z�Z	S)
r�cs(t���||_||_||_|j|_dSr()r[r�_messager"r�rY)rr"r�r�r`rrr�s

z_SubTest.__init__cCstd��dS)Nzsubtests cannot be run directly)rrjrrrr��sz_SubTest.runTestcCs^g}|jtur |�d�|j��|jrPd�dd�|j��D��}|�d�|��d�|�p\dS)Nz[{}]z, css|]\}}d�||�VqdS)z{}={!r}N)rm)rMr�r�rrrrP�s�z+_SubTest._subDescription.<locals>.<genexpr>z({})� z(<subtest>))rbrYrrmr�rr4)r�partsZparams_descrrr�_subDescription�s

�z_SubTest._subDescriptioncCsd�|j��|���S�Nz{} {})rmr"r�rerjrrrr��sz_SubTest.idcCs
|j��Sr()r"r�rjrrrr��sz_SubTest.shortDescriptioncCsd�|j|���Srf)rmr"rerjrrrr��sz_SubTest.__str__)
rrr
rr�rer�r�r�rarrr`rr��sr�)-r r=rrr]r�r9r&rnrDrCr�utilrrrrrZ
__unittest�objectrYr#r2r	rrrr*r+r/r5rFrIrJrrLrVr\rir|�ChainMapr�r�rZr�rrrr�<module>sV(	*'5
:

?>