ok

Mini Shell

Direktori : /proc/self/root/opt/alt/python37/lib64/python3.7/unittest/__pycache__/
Upload File :
Current File : //proc/self/root/opt/alt/python37/lib64/python3.7/unittest/__pycache__/case.cpython-37.opt-2.pyc

B

�w�c%��@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'e�(d'd(d)g�Z)Gd*d+�d+ej*�Z+Gd,d-�d-e"�Z,Gd.d/�d/ej-�Z.Gd0d1�d1e�Z/Gd2d3�d3e/�Z0Gd4d5�d5e/�Z1dS)6�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
�2/opt/alt/python37/lib64/python3.7/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__Fc
cs�|j}d|_z�y
dVWn�tk
r.�Yn�tk
rh}zd|_|j�|t|�f�Wdd}~XYnjtk
rzYnXt��}|j	r�||_
nd|_|j�||f�d}YnX|jr�|jr�|j�|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$t�|��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 |j�|j|�}|j�|��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
rKcst����fdd��}|S)NcsNdtjkr@y�||�Wn tk
r8tt����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@t�||�||_||_|dk	r*t�|�}||_d|_d|_dS)N)	rBrrAr!�re�compile�expected_regex�obj_namerD)rrAr!rSr
r
rr�s
z!_AssertRaisesBaseContext.__init__c	Cs�z�t|j|j�s"td||jf��|rD|ddkrDt�dtd�d}|sx|�dd�|_	|rtt�dt
t|��td�|S|^}}y|j|_
Wntk
r�t|�|_
YnX|�|||�WdQRXWdd}XdS)Nz%s() arg 1 must be %srzcallable is None�r
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__cCs�|dkrby|jj}Wntk
r2t|j�}YnX|jrP|�d�||j��ql|�d�|��n
t�|�t	||j�s|dS|�
d�|_|jdkr�dS|j}|�
t|��s�|�d�|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 typescCsVx(ttj���D]}t|dd�ri|_qWtjdd�|_|j�	�|_t�
d|j�|S)N�__warningregistry__T)�record�always)�listr�modules�values�getattrrqrY�catch_warnings�warnings_managerrc�simplefilterrA)r�vr
r
rrc	s
z_AssertWarnsContext.__enter__cCs|j�|||�|dk	rdSy|jj}Wntk
rFt|j�}YnXd}xb|jD]X}|j}t||j�slqT|dkrx|}|j	dk	r�|j	�
t|��s�qT||_|j|_|j
|_
dSW|dk	r�|�d�|j	jt|���|jr�|�d�||j��n|�d�|��dS)Nz"{}" does not match "{}"z{} not triggered by {}z{} not triggered)ryrnrAr
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)�_CapturingHandlercCstj�|�tgg�|_dS)N)�logging�Handlerrr��watcher)rr
r
rrAsz_CapturingHandler.__init__cCsdS)Nr
)rr
r
r�flushEsz_CapturingHandler.flushcCs*|jj�|�|�|�}|jj�|�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:t�||�||_|r(tj�||�|_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}|_nt�|j�}|_t�|j�}t�}|�	|�|j
|_
|jdd�|_|j
|_|j|_|g|_|�|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_|j�|j�|dk	r.dSt|jj	�dkr\|�
d�t�
|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@seZdZdd�ZdS)�_OrderedChainMapccs@t�}x4|jD]*}x$|D]}||kr|�|�|VqWqWdS)N)�set�maps�add)r�seen�mapping�kr
r
r�__iter__|s

z_OrderedChainMap.__iter__N)r
rrr�r
r
r
rr�{sr�c@s�eZdZeZdZdZdZdZd�dd�Z	dd	�Z
d
d�Zdd
�Zdd�Z
edd��Zedd��Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zejefd&d'��Zd(d)�Zd*d+�Zd,d-�Z d�d/d0�Z!d1d2�Z"d3d4�Z#d5d6�Z$d7d8�Z%d�d9d:�Z&d�d;d<�Z'd�d=d>�Z(d?d@�Z)dAdB�Z*dCdD�Z+d�dEdF�Z,dGdH�Z-d�dIdJ�Z.d�dKdL�Z/d�dMdN�Z0d�dOdP�Z1d�dQdR�Z2d�dSdT�Z3dUdV�Z4d�dWdX�Z5d�dYdZ�Z6d�d[d\�Z7d�d]d^�Z8d�d_d`�Z9d�dadb�Z:d�dcdd�Z;d�dedf�Z<d�dgdh�Z=d�didj�Z>d�dkdl�Z?d�dmdn�Z@d�dodp�ZAd�dqdr�ZBd�dsdt�ZCd�dudv�ZDd�dwdx�ZEd�dydz�ZFd�d{d|�ZGd}d~�ZHdd��ZId�d�d��ZJd�d�d��ZKd�d��ZLeLe/�ZMZNeLe0�ZOZPeLe1�ZQZReLe2�ZSZTeLe(�ZUZVeLe*�ZWeLe'�ZXeLeH�ZYeLeJ�ZZeLeK�Z[d.S)��TestCaseTi�iF�runTestcCs�||_d|_d|_yt||�}Wn.tk
rN|dkrJtd|j|f��Yn
X|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�_testMethodDocrwr_�
ValueError�	__class__�__doc__�	_cleanups�_subtest�_type_equality_funcs�addTypeEqualityFunc�dictrtr>r��	frozensetr)rZ
methodName�
testMethodr
r
rr�s&zTestCase.__init__cCs||j|<dS)N)r�)rZtypeobj�functionr
r
rr��s
zTestCase.addTypeEqualityFunccOstt|�dkr|^}}}n>|s&td��n0d|krB|�d�}|^}}ntdt|�d��t|�}|j�|||f�dS)N�z>descriptor 'addCleanup' of 'TestCase' object needs an argumentr�z:addCleanup expected at least 1 positional argument, got %dr)r�rWr\r>r�r)r)r*rr�r
r
r�
addCleanup�s


zTestCase.addCleanupcCsdS)Nr
)rr
r
r�setUp�szTestCase.setUpcCsdS)Nr
)rr
r
r�tearDown�szTestCase.tearDowncCsdS)Nr
)�clsr
r
r�
setUpClassszTestCase.setUpClasscCsdS)Nr
)r�r
r
r�
tearDownClassszTestCase.tearDownClasscCsdS)Nrr
)rr
r
r�countTestCasesszTestCase.countTestCasescCst��S)N)rZ
TestResult)rr
r
r�defaultTestResultszTestCase.defaultTestResultcCs$|j}|r |���d�d��SdS)N�
r)r��strip�split)r�docr
r
r�shortDescriptionszTestCase.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 |||�nt�dtd�|�|�dS)N�addSkipz4TestResult has no addSkip method, skips not reportedr�)rwrYrZ�RuntimeWarning�
addSuccess)rrr!r+r�r
r
r�_addSkip,szTestCase._addSkipc	ks�|jdks|jjsdVdS|j}|dkr4t|�}n|j�|�}t|||�|_zX|jj|jdd��dVWdQRX|jjs�|jj	}|dk	r�|j
r�t�n|jjr�t�Wd||_XdS)NT)r")
r�rr�r��params�	new_child�_SubTestr$rrZfailfastrr)rrDr��parentZ
params_maprr
r
r�subTest5s$
zTestCase.subTestcCsdx^|D]V\}}t|t�r*|�|j||�q|dk	rt|d|j�rP|�||�q|�||�qWdS)Nr)r-r�rr!r@rE�
addFailureZaddError)rrr�testr r
r
r�_feedErrorsToResultTs
zTestCase._feedErrorsToResultcCsDy
|j}Wn*tk
r4t�dt�|�|�YnX|||�dS)Nz@TestResult has no addExpectedFailure method, reporting as passes)�addExpectedFailurer_rYrZr�r�)rrr r�r
r
r�_addExpectedFailure^s
zTestCase._addExpectedFailurecCshy
|j}WnPtk
rZt�dt�y
td�Wn$tk
rT|�|t���YnXYn
X||�dS)NzCTestResult has no addUnexpectedSuccess method, reporting as failure)	�addUnexpectedSuccessr_rYrZr�rr�rr )rrr�r
r
r�_addUnexpectedSuccesshs

zTestCase._addUnexpectedSuccessNc

Cs|}|dkr.|��}t|dd�}|dk	r.|�|�|�t||j�}t|jdd�s^t|dd�r�z,t|jdd�pxt|dd�}|�|||�Wd|�|�XdSt|dd�}t|dd�}|p�|}t|�}	z�|	|_|	�	|��|�
�WdQRX|	j�r<||	_|	j	|dd��|�WdQRXd|	_|	�	|��|�
�WdQRX|��x"|	jD]\}
}|�||
|��qLW|�||	j�|	j�r�|�r�|	j�r�|�||	j�n
|�|�n
|�|�|S|�|�|dk�r�t|d	d�}|dk	�r�|�|	j��d|	_d|_XdS)
N�startTestRunr1Fr2�r9T)r"�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�runwsh





zTestCase.runc	CsN|jp
t�}x:|jrF|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|��t||j��|��x&|jrD|j�d�\}}}|||�q WdS)N���)r�rwr�r�r�r\)rr�r)r*r
r
r�debug�szTestCase.debugcCst|��dS)N)r	)rr+r
r
r�skipTest�szTestCase.skipTestcCs|�|��dS)N)rE)rrDr
r
r�fail�sz
TestCase.failcCs&|r"|�|dt|��}|�|��dS)Nz%s is not false)rCrrE)r�exprrDr
r
r�assertFalse�szTestCase.assertFalsecCs&|s"|�|dt|��}|�|��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._formatMessagecOs$t||�}z|�d||�Sd}XdS)N�assertRaises)rbra)r�expected_exceptionr)r*�contextr
r
rr��s
zTestCase.assertRaisescOst||�}|�d||�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@|j�t|��}|dk	r@t|t�r<t||�}|S|jS)N)r.r�r�r-rrw�_baseAssertEqual)r�first�secondZasserterr
r
r�_getAssertEqualityFuncTs

zTestCase._getAssertEqualityFunccCs0||ks,dt||�}|�||�}|�|��dS)Nz%s != %s)rrCrE)rr�r�rDrFr
r
rr�nszTestCase._baseAssertEqualcCs|�||�}||||d�dS)N)rD)r�)rr�r�rDZassertion_funcr
r
r�assertEqualuszTestCase.assertEqualcCs2||ks.|�|dt|�t|�f�}|�|��dS)Nz%s == %s)rCrrE)rr�r�rDr
r
r�assertNotEqual|szTestCase.assertNotEqualcCs�||krdS|dk	r$|dk	r$td��t||�}|dk	rf||krDdSdt|�t|�t|�t|�f}n:|dkrrd}t||�dkr�dSdt|�t|�|t|�f}|�||�}|�|��dS)Nz specify delta or places not bothz(%s != %s within %s delta (%s difference)�rz)%s != %s within %r places (%s difference))rW�absr�roundrCrE)rr�r��placesrD�delta�diffrFr
r
r�assertAlmostEqual�s0zTestCase.assertAlmostEqualcCs�|dk	r|dk	rtd��t||�}|dk	rb||ks@||kr@dSdt|�t|�t|�t|�f}n<|dkrnd}||ks�t||�dkr�dSdt|�t|�|f}|�||�}|�|��dS)Nz specify delta or places not bothz(%s == %s within %s delta (%s difference)r�rz%s == %s within %r places)rWr�rr�rCrE)rr�r�r�rDr�rrFr
r
r�assertNotAlmostEqual�s(zTestCase.assertNotAlmostEqualcCs�|dk	rP|j}t||�s.|�d|t|�f��t||�sT|�d|t|�f��nd}d}yt|�}Wn ttfk
r�d|}YnX|dkr�yt|�}Wn ttfk
r�d|}YnX|dk�r�||kr�dSd|��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|}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�)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|rZmax_diffr
r
rr8szTestCase._truncateMessagecCs|j|||td�dS)N)r)rrt)rZlist1Zlist2rDr
r
rr�>s
zTestCase.assertListEqualcCs|j|||td�dS)N)r)rr>)rZtuple1Ztuple2rDr
r
rr�Js	zTestCase.assertTupleEqualc

Cshy|�|�}Wn^tk
r>}z|�d|�Wdd}~XYn0tk
rl}z|�d|�Wdd}~XYnXy|�|�}Wn^tk
r�}z|�d|�Wdd}~XYn0tk
r�}z|�d|�Wdd}~XYnX|s�|s�dSg}|�r|�d�x|D]}|�t|���qW|�rH|�d�x|D]}|�t|���q0Wd�|�}	|�|�||	��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�Us2
  




zTestCase.assertSetEqualcCs2||kr.dt|�t|�f}|�|�||��dS)Nz%s not found in %s)rr�rC)r�member�	containerrDrFr
r
r�assertIn�szTestCase.assertIncCs2||kr.dt|�t|�f}|�|�||��dS)Nz%s unexpectedly found in %s)rr�rC)rrrrDrFr
r
r�assertNotIn�szTestCase.assertNotIncCs2||k	r.dt|�t|�f}|�|�||��dS)Nz%s is not %s)rr�rC)r�expr1�expr2rDrFr
r
r�assertIs�szTestCase.assertIscCs,||kr(dt|�f}|�|�||��dS)Nzunexpectedly identical: %s)rr�rC)rrrrDrFr
r
r�assertIsNot�szTestCase.assertIsNotc	Cs~|�|td�|�|td�||krzdt||�}dd�t�t�|���t�|�����}|�	||�}|�
|�||��dS)Nz"First argument is not a dictionaryz#Second argument is not a dictionaryz%s != %sr�)�assertIsInstancer�rrr	r
rrr
rr�rC)rZd1Zd2rDrFrr
r
rr��s
zTestCase.assertDictEqualc		Cs�t�dt�g}g}xX|��D]L\}}||kr:|�|�q|||kr|�dt|�t|�t||�f�qW|sz|szdSd}|r�dd�dd�|D��}|r�|r�|d7}|d	d�|�7}|�|�||��dS)
Nz&assertDictContainsSubset is deprecatedz%s, expected: %s, actual: %sr�zMissing: %s�,css|]}t|�VqdS)N)r)r;rr
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|�}}yt�|�}t�|�}Wntk
rHt||�}YnX||krVdSt||�}|r�d}dd�|D�}d�|�}	|�||	�}|�||�}|�	|�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�)
rt�collections�CounterrWrrrrrCr�)
rr�r�rDZ	first_seqZ
second_seqZdifferencesrFrrr
r
r�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�z%s != %sr�)r!rr��_diffThresholdr�r
r�rrr	r
rr�rC)rr�r�rDZ
firstlinesZsecondlinesrFrr
r
rr��s

zTestCase.assertMultiLineEqualcCs2||ks.dt|�t|�f}|�|�||��dS)Nz%s not less than %s)rr�rC)r�a�brDrFr
r
r�
assertLess�szTestCase.assertLesscCs2||ks.dt|�t|�f}|�|�||��dS)Nz%s not less than or equal to %s)rr�rC)rr.r/rDrFr
r
r�assertLessEqual�szTestCase.assertLessEqualcCs2||ks.dt|�t|�f}|�|�||��dS)Nz%s not greater than %s)rr�rC)rr.r/rDrFr
r
r�
assertGreaterszTestCase.assertGreatercCs2||ks.dt|�t|�f}|�|�||��dS)Nz"%s not greater than or equal to %s)rr�rC)rr.r/rDrFr
r
r�assertGreaterEqualszTestCase.assertGreaterEqualcCs,|dk	r(dt|�f}|�|�||��dS)Nz%s is not None)rr�rC)rr'rDrFr
r
r�assertIsNoneszTestCase.assertIsNonecCs"|dkrd}|�|�||��dS)Nzunexpectedly None)r�rC)rr'rDrFr
r
r�assertIsNotNoneszTestCase.assertIsNotNonecCs0t||�s,dt|�|f}|�|�||��dS)Nz%s is not an instance of %r)r-rr�rC)rr'r�rDrFr
r
rr!s
zTestCase.assertIsInstancecCs0t||�r,dt|�|f}|�|�||��dS)Nz%s is an instance of %r)r-rr�rC)rr'r�rDrFr
r
r�assertNotIsInstance$s
zTestCase.assertNotIsInstancecOst|||�}|�d||�S)N�assertRaisesRegex)rbra)rr�rSr)r*r�r
r
rr7*s
zTestCase.assertRaisesRegexcOst|||�}|�d||�S)N�assertWarnsRegex)rpra)rr�rSr)r*r�r
r
rr8:szTestCase.assertWarnsRegexcCsJt|ttf�rt�|�}|�|�sFd|j|f}|�||�}|�|��dS)Nz&Regex didn't match: %r not found in %r)	r-r�bytesrQrRrhrirCrE)r�textrSrDrFr
r
r�assertRegexMs

zTestCase.assertRegexcCs`t|ttf�rt�|�}|�|�}|r\d||��|���|j|f}|�	||�}|�
|��dS)Nz"Regex matched: %r matches %r in %r)r-rr9rQrRrh�start�endrirCrE)rr:Zunexpected_regexrD�matchrFr
r
r�assertNotRegexYs

zTestCase.assertNotRegexcs�fdd�}|S)Ncs t�d��j�td��||�S)NzPlease use {0} instead.r�)rYrZrdr
r[)r)r*)�
original_funcr
r�deprecated_funcis
z,TestCase._deprecate.<locals>.deprecated_funcr
)r@rAr
)r@r�
_deprecatehs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)\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�rrrrr�r�r�rrrr r�r'r+r�r0r1r2r3r4r5r!r6r7r8r;r?rBZfailUnlessEqualZ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|���||_||_||_||_dS)N)�superrFr�
_setUpFunc�
_tearDownFunc�	_testFunc�_description)rZtestFuncr�r��description)r�r
rr�s
zFunctionTestCase.__init__cCs|jdk	r|��dS)N)rH)rr
r
rr��s
zFunctionTestCase.setUpcCs|jdk	r|��dS)N)rI)rr
r
rr��s
zFunctionTestCase.tearDowncCs|��dS)N)rJ)rr
r
rr��szFunctionTestCase.runTestcCs|jjS)N)rJr
)rr
r
rr��szFunctionTestCase.idcCs@t||j�stS|j|jko>|j|jko>|j|jko>|j|jkS)N)r-r�r�rHrIrJrK)rr�r
r
rr��szFunctionTestCase.__eq__cCstt|�|j|j|j|jf�S)N)r�r.rHrIrJrK)rr
r
rr��szFunctionTestCase.__hash__cCsdt|j�|jjfS)Nz%s (%s))rr�rJr
)rr
r
rr��s
zFunctionTestCase.__str__cCsdt|j�|jfS)Nz<%s tec=%s>)rr�rJ)rr
r
rr��s
zFunctionTestCase.__repr__cCs2|jdk	r|jS|jj}|r.|�d�d��p0dS)Nr�r)rKrJr�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�rrF~s		rFcsDeZdZ�fdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Z�Z	S)
r�cs(t���||_||_||_|j|_dS)N)rGr�_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.runTestcCs^g}|jtk	r |�d�|j��|jrPd�dd�|j��D��}|�d�|��d�|�p\dS)Nz[{}]z, css|]\}}d�||�VqdS)z{}={!r}N)rd)r;r�r{r
r
rr=�sz+_SubTest._subDescription.<locals>.<genexpr>z({})� z(<subtest>))rNrErrdr�rr#)r�partsZparams_descr
r
r�_subDescription�s
z_SubTest._subDescriptioncCsd�|j��|���S)Nz{} {})rdr!r�rQ)rr
r
rr��sz_SubTest.idcCs
|j��S)N)r!r�)rr
r
rr��sz_SubTest.shortDescriptioncCsd�|j|���S)Nz{} {})rdr!rQ)rr
r
rr��sz_SubTest.__str__)
r
rrrr�rQr�r�r�rMr
r
)r�rr��sr�)2rr/r	rIr�rrQrYr)r%rer�r�utilrrrrrZ
__unittest�objectrErrLr	rrrr(r5r7r8rr:rBrKrOrPrbrp�
namedtupler�r�r�r��ChainMapr�r�rFr�r
r
r
r�<module>s^(
/%5
,
:

Zerion Mini Shell 1.0