python (3.12.0)

(root)/
lib/
python3.12/
unittest/
__pycache__/
case.cpython-312.opt-1.pyc

̑edZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlm
Z
ddlmZmZmZmZmZdZeZdZGdd	eZGd
deZGdd
eZGddeZdZdZdZdZ gZ!dZ"dZ#dZ$dZ%dZ&dZ'dZ(dZ)GddZ*Gdde*Z+Gd d!e+Z,Gd"d#e+Z-Gd$d%ej\Z/Gd&d'eZ0Gd(d)e0Z1Gd*d+e0Z2y),zTest case implementationN)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.ceZdZdZy)SkipTestz
    Raise this exception in a test to skip it.

    Usually you can use TestCase.skipTest() or one of the skipping decorators
    instead of raising this directly.
    N__name__
__module____qualname____doc__A/BuggyBox/python/3.12.0/bootstrap/lib/python3.12/unittest/case.pyrrsrrceZdZdZy)_ShouldStopz
    The test should stop.
    Nrrrrrr"rrceZdZdZy)_UnexpectedSuccessz7
    The test was supposed to fail, but it didn't!
    Nrrrrrr'rrrc:eZdZddZej
ddZy)_OutcomeNc^d|_||_t|d|_d|_d|_y)NF
addSubTestT)expecting_failurerhasattrresult_supports_subtestssuccessexpectedFailure)selfrs  r__init__z_Outcome.__init__.s/!&(/(E%#rc#K|j}d|_	d|r4|jr(|jj|j|d	|jxr||_y#t$rt
$r1}d|_t
|j|t|Yd}~Td}~wt$rYbtj}|jr||_nHd|_|r(|jj|j||nt|j||d}YxYw#|jxr||_wxYww)NTF)r rr	test_caseKeyboardInterruptr_addSkipstrrsysexc_inforr!	_addError)r"r%subTestold_successer*s      rtestPartExecutorz_Outcome.testPartExecutor5sll	8,4<<&&y':':ItL<<7KDL1!		5 DLT[[)SV44		||~H%%'/$$KK**9+>+>	8Tdkk9h?H
 <<7KDLsLEA'6D+E'D(9'B% D+%D(1D+3A3D(&D++EEN)F)r
rrr#
contextlibcontextmanagerr/rrrrr-s!$88rrct|dd}|
|||ytjdtd|j|y)NaddSkipz4TestResult has no addSkip method, skips not reported)getattrwarningswarnRuntimeWarning
addSuccess)rr%reasonr4s    rr'r'VsDfi.G	6"

L$a	))$rc|D|At|d|jr|j||y|j||yyy)Nr)
issubclassfailureException
addFailureaddError)rtestr*s   rr+r+_sK
h2hqk4#8#89FdH-FOOD(+	3rc|Sr0r)objs r_idrDfsJrct|}	|j}|j}||}|||ddd|S#t$r(t	d|j
d|jddwxYw)N'.z6' object does not support the context manager protocol)type	__enter____exit__AttributeError	TypeErrorrr)cm
addcleanupclsenterexitrs      r_enter_contextrRjsr(CO

||2YFtRtT*MO!CNN+1S-=-=,>?CDEJN	OOs	;1A,c4tj|||fy)znSame as addCleanup, except the cleanup items are called even if
    setUpModule fails (unlike tearDownModule).N)_module_cleanupsappend)functionargskwargss   raddModuleCleanuprYzsXtV45rc"t|tS)z&Same as enterContext, but module-wide.)rRrY)rMs renterModuleContextr[s".//rcg}tr(tj\}}}	||i|tr(|r|dy#t$r}|j|Yd}~.d}~wwxYw)zWExecute all module cleanup functions. Normally called for you after
    tearDownModule.Nr)rTpop	ExceptionrU)
exceptionsrVrWrXexcs     rdoModuleCleanupsrasqJ
!1!5!5!7$	#d%f%m	#c""	#s9	AAAc^fd}ttjr}d||S|S)z&
    Unconditionally skip a test.
    ct|tstj|fd}|}d|_|_|S)Nctr0r)rWrXr;s  rskip_wrapperz-skip.<locals>.decorator.<locals>.skip_wrappersv&&rT)
isinstancerH	functoolswraps__unittest_skip____unittest_skip_why__)	test_itemrfr;s  r	decoratorzskip.<locals>.decoratorsC)T*
__Y
'
'(
'$I&*	#*0	'r)rgtypesFunctionType)r;rmrls`  rskiprqs5	&%,,-	##rc(|rt|StS)z/
    Skip a test if the condition is true.
    rqrD	conditionr;s  rskipIfrvsF|Jrc(|st|StS)z3
    Skip a test unless the condition is true.
    rsrts  r
skipUnlessrxsF|Jrcd|_|S)NT)__unittest_expecting_failure__)rls rr!r!s/3I,rct|trtfd|DSt|txrt	|S)Nc36K|]}t|ywr0)_is_subtype).0r.basetypes  r	<genexpr>z_is_subtype.<locals>.<genexpr>s>;q(+>s)rgtupleallrHr=)expectedrs `rr}r}s7(E">X>>>h%H*Xx*HHrceZdZdZdZy)_BaseTestCaseContextc||_yr0)r%)r"r%s  rr#z_BaseTestCaseContext.__init__s	"rc|jj|j|}|jj|r0)r%_formatMessagemsgr>)r"standardMsgrs   r
_raiseFailurez"_BaseTestCaseContext._raiseFailures1nn++DHHkBnn--c22rN)r
rrr#rrrrrrs#3rrceZdZddZdZy)_AssertRaisesBaseContextNctj||||_||_|t	j
|}||_d|_d|_yr0)	rr#rr%recompileexpected_regexobj_namer)r"rr%rs    rr#z!_AssertRaisesBaseContext.__init__sJ%%dI6 
"%ZZ7N,
rc	t|j|jst|d|j|s=|jdd|_|r ttt|d|d}S|^}}	|j|_
|5||i|dddd}y#t$rt||_
Y1wxYw#1swYd}yxYw#d}wxYw)z
        If args is empty, assertRaises/Warns is being used as a
        context manager, so check for a 'msg' kwarg and return self.
        If args is not empty, call a callable passing positional and keyword
        arguments.
        z() arg 1 must be rNz1 is an invalid keyword argument for this function)
r}r
_base_typerL_base_type_strr]rnextiterr
rrKr()r"namerWrXcallable_objs     rhandlez_AssertRaisesBaseContext.handles	t}}doo>!%t':':!<==!::eT2#7;DL7I%LMMD#'L4
2 , 5 5

.d-f-
.D
"
2 #L 1

2
.D4DsTA6C;CB'C	CC'CCCCCCCCr0)r
rrr#rrrrrrsrrcHeZdZdZeZdZdZdZe	e
jZy)_AssertRaisesContextzCA context manager used to implement TestCase.assertRaises* methods.z-an exception type or tuple of exception typesc|Sr0rr"s rrIz_AssertRaisesContext.__enter__src|p	|jj}|jr,|jdj
||jn6|jdj
|ntj|t||jsy|jd|_|jy|j}|jt|s4|jdj
|jt|y#t$rt|j}Y$wxYw)Nz{} not raised by {}z
{} not raisedFT"{}" does not match "{}")rr
rKr(rrformat	tracebackclear_framesr=with_traceback	exceptionrsearchpattern)r"exc_type	exc_valuetbexc_namers      rrJz_AssertRaisesContext.__exit__s
.==11}}""#8#?#?@D

$OP""?#9#9(#CD""2&(DMM2"11$7&,,$$S^49@@#++S^ =
>+"
.t}}-
.sDD?>D?N)
r
rrr
BaseExceptionrrrIrJclassmethodroGenericAlias__class_getitem__rrrrrs,MJDN6$E$6$67rrc$eZdZdZeZdZdZdZy)_AssertWarnsContextzBA context manager used to implement TestCase.assertWarns* methods.z(a warning type or tuple of warning typesc<ttjjD]}t	|ddsi|_t
jd|_|jj|_t
jd|j|S)N__warningregistry__T)recordalways)listr)modulesvaluesr6rr7catch_warningswarnings_managerrIsimplefilterr)r"vs  rrIz_AssertWarnsContext.__enter__!s~ckk((*+	+Aq/6(*%	+!) 7 7t D--779
h

6rc|jj||||y	|jj}d}|jD]}|j}t||js&||}|j%|jjt|s[||_|j|_|j|_
y|>|jdj|jj t||j"r,|jdj||j"y|jdj|y#t$rt|j}YOwxYw)Nrz{} not triggered by {}z{} not triggered)rrJrr
rKr(r7messagergrrwarningfilenamelinenorrrr)r"rrrrfirst_matchingmws        rrJz_AssertWarnsContext.__exit__,sb&&xB?	*}}--H
	A		Aa/%!"##/''..s1v6DLJJDM((DK
	%9@@((00#n2E G
H==7>>x?C}} N
O
188BC3	*4==)H	*sE&&FFN)	r
rrrWarningrrrIrJrrrrrsLJ?N	 DrrceZdZdZy)_OrderedChainMapc#Kt}|jD]#}|D]}||vs|j||%ywr0)setmapsadd)r"seenmappingks    r__iter__z_OrderedChainMap.__iter__PsFuyy	G
D=HHQKG
	s
#AAN)r
rrrrrrrrOsrrcteZdZdZeZdZdZdZfdZ	dLdZ
dZdZd	Z
ed
ZedZdZd
ZedZedZdZdZdZdZdZdZdZdZej<efdZ dZ!dZ"dZ#dZ$dZ%dZ&dZ'dMd Z(d!Z)ed"Z*d#Z+d$Z,d%Z-dMd&Z.dMd'Z/dMd(Z0d)Z1d*Z2d+Z3dNd,Z4dNd-Z5d.Z6dMd/Z7dMd0Z8dMd1Z9		dOd2Z:		dOd3Z;dNd4Z<d5Z=dMd6Z>dMd7Z?dMd8Z@dMd9ZAdMd:ZBdMd;ZCdMd<ZDdMd=ZEdMd>ZFdMd?ZGdMd@ZHdMdAZIdMdBZJdMdCZKdMdDZLdMdEZMdMdFZNdMdGZOdHZPdIZQdMdJZRdMdKZSxZTS)PTestCaseaWA class whose instances are single test cases.

    By default, the test code itself should be placed in a method named
    'runTest'.

    If the fixture may be used for many test cases, create as
    many test methods as are needed. When instantiating such a TestCase
    subclass, specify in the constructor arguments the name of the test method
    that the instance is to execute.

    Test authors should subclass TestCase for their own tests. Construction
    and deconstruction of the test's environment ('fixture') can be
    implemented by overriding the 'setUp' and 'tearDown' methods respectively.

    If it is necessary to override the __init__ method, the base class
    __init__ method must always be called. It is important that subclasses
    should not change the signature of their __init__ method, since instances
    of the classes are instantiated automatically by parts of the framework
    in order to be run.

    When subclassing TestCase, you can set these attributes:
    * failureException: determines which exception will be raised when
        the instance's assertion methods fail; test methods raising this
        exception will be deemed to have 'failed' rather than 'errored'.
    * longMessage: determines whether long messages (including repr of
        objects used in assert methods) will be printed on failure in *addition*
        to any explicit message passed.
    * maxDiff: sets the maximum length of a diff in failure messages
        by assert methods using difflib. It is looked up as an instance
        attribute so can be configured by individual tests if required.
    Tiic@d|_g|_t||i|y)NF)_classSetupFailed_class_cleanupssuper__init_subclass__)rOrWrX	__class__s   rrzTestCase.__init_subclass__s% % 
!4262rc||_d|_d|_	t||}|j|_g|_d|_	i|_
|jtd|jtd|jtd|jtd	|jt d	|jt"d
y#t
$r#|dk7rt
d|jd|YwxYw)zCreate an instance of the class that will use the named test
           method when executed. Raises a ValueError if the instance does
           not have a method with the specified name.
        NzNo testrunTestzno such test method in : assertDictEqualassertListEqualassertTupleEqualassertSetEqualassertMultiLineEqual)_testMethodName_outcome_testMethodDocr6rrK
ValueErrorr	_cleanups_subtest_type_equality_funcsaddTypeEqualityFuncdictrrr	frozensetr()r"
methodName
testMethods   rr#zTestCase.__init__s
 *
'		5 z2J#-"4"4D
%'!  '89  '89  (:;  &67  ,<=  &<=)	4Y&!~~z"344'	4sC)C:9C:c"||j|<y)a[Add a type specific assertEqual style function to compare a type.

        This method is for use by TestCase subclasses that need to register
        their own type equality functions to provide nicer error messages.

        Args:
            typeobj: The data type to call this function on when both values
                    are of the same type in assertEqual().
            function: The callable taking two arguments and an optional
                    msg= argument that raises self.failureException with a
                    useful error message when the two arguments are not equal.
        N)r)r"typeobjrVs   rrzTestCase.addTypeEqualityFuncs.6!!'*rc@|jj|||fy)aAdd a function, with arguments, to be called when the test is
        completed. Functions added are called on a LIFO basis and are
        called after tearDown on test failure or success.

        Cleanup items are called even if setUp fails (unlike tearDown).N)rrUr"rVrWrXs    r
addCleanupzTestCase.addCleanups	
xv67rc.t||jS)zEnters the supplied context manager.

        If successful, also adds its __exit__ method as a cleanup
        function and returns the result of the __enter__ method.
        )rRr)r"rMs  renterContextzTestCase.enterContextsb$//22rc@|jj|||fy)zpSame as addCleanup, except the cleanup items are called even if
        setUpClass fails (unlike tearDownClass).N)rrUrOrVrWrXs    raddClassCleanupzTestCase.addClassCleanups	""HdF#;<rc.t||jS)z%Same as enterContext, but class-wide.)rRr)rOrMs  renterClassContextzTestCase.enterClassContextsb#"5"566rcy)zAHook method for setting up the test fixture before exercising it.Nrrs rsetUpzTestCase.setUprcy)zAHook method for deconstructing the test fixture after testing it.Nrrs rtearDownzTestCase.tearDownrrcy)zKHook method for setting up class fixture before running tests in the class.NrrOs r
setUpClasszTestCase.setUpClassrcy)zVHook method for deconstructing the class fixture after running all tests in the class.Nrrs r
tearDownClasszTestCase.tearDownClassrrcy)Nrrrs rcountTestCaseszTestCase.countTestCasessrc*tjSr0)r
TestResultrs rdefaultTestResultzTestCase.defaultTestResults  ""rc|j}|r0|jjddjSdS)zReturns a one-line description of the test, or None if no
        description has been provided.

        The default implementation of this method returns the first line of
        the specified test method's docstring.
        
rN)rstripsplitr"docs  rshortDescriptionzTestCase.shortDescriptions;!!58syy{  &q)//1BdBrcJt|jd|jS)NrGrrrrs ridzTestCase.ids"4>>2D4H4HIIrclt|t|urtS|j|jk(Sr0)rHNotImplementedrr"others  r__eq__zTestCase.__eq__s/:T%[(!!##u'<'<<<rcBtt||jfSr0)hashrHrrs r__hash__zTestCase.__hash__sT$Z!5!5677rcf|jdt|jd|jdS)N (rG))rrrrs r__str__zTestCase.__str__s$#33Xdnn5MtOcOcddrcNdt|jd|jdS)N<z testMethod=>rrs r__repr__zTestCase.__repr__s"($*>*>@	@rc+HK|j|jjsdy|j}|t|}n|jj|}t
||||_	|jj|jd5dddd|jjs*|jj}|.|jr"t|jjrt||_y#1swYmxYw#||_wxYww)aPReturn a context manager that will return the enclosed block
        of code in a subtest identified by the optional message and
        keyword parameters.  A failure in the subtest marks the test
        case as failed but resumes execution at the end of the enclosed
        block, allowing further test code to be executed.
        NT)r,)
rrrrparams	new_child_SubTestr/r rfailfastrr!)r"rr#parent
params_maprs      rr,zTestCase.subTests== 

(N(N>)&1J008J sJ7
	#//

t/L

==((--%&//%%.."!"DM

#DMs7A/D"2'DD
A$DD"
DD	DD"c	|j}|||y#t$r/tjdt|j
|YywxYw)Nz@TestResult has no addExpectedFailure method, reporting as passes)addExpectedFailurerKr7r8r9r:)r"rr*r*s    r_addExpectedFailurezTestCase._addExpectedFailure'sR	/!'!:!:
tX.	$MM\(
*Fd#	$s5AAc	|j}||y#t$rXtjdt	t
d#t
$r)|j|tjYYywxYwwxYw)NzCTestResult has no addUnexpectedSuccess method, reporting as failure)	addUnexpectedSuccessrKr7r8r9rr?r)r*)r"rr-s   r_addUnexpectedSuccesszTestCase._addUnexpectedSuccess1st	'#)#>#> 
!&	8MM_(
*
8(d2%
8!!!$7
8	8s&#A8A.A40A83A44A8c	|j}|||y#t$rtjdtYywxYw)Nz$TestResult has no addDuration method)addDurationrKr7r8r9)r"relapsedr0s    r_addDurationzTestCase._addDuration@sA	' ,,K

g&		*MM@(
*	*s#>>c$|jyr0)rrs r
_callSetUpzTestCase._callSetUpIs

rcT|!tjd|dtdyy)NzFIt is deprecated to return a value that is not None from a test case (r)
stacklevel)r7r8DeprecationWarning)r"methods  r_callTestMethodzTestCase._callTestMethodLs38MM((.xq23ERS
U rc$|jyr0)rrs r
_callTearDownzTestCase._callTearDownQs

rc||i|yr0rrs    r_callCleanupzTestCase._callCleanupTs$!&!rc|4|j}t|dd}t|dd}|
|nd}|j|	t||j}t|jdds
t|ddrQt|jddxs
t|dd}t|||||j|||SSt|ddxs
t|dd}t|}tj}	||_
|j|5|jddd|jrc||_|j|5|j|dddd|_|j|5|j!ddd|j#|j%|tj|z
|jrO|r;|j&r|j)||j&n$|j+|n|j,||d|_d}d|_
|j|||SS#1swY9xYw#1swYxYw#1swYxYw#d|_d}d|_
wxYw#|j|||wwxYw)NstartTestRunstopTestRunrjFrkrnrz)rr6	startTestrrr'stopTestrtimeperf_counterrr/r4r rr:r<
doCleanupsr2r!r+r.r:)	r"rr@rArskip_whyroutcome
start_times	         rrunzTestCase.runWs>++-F"6>4@L!&->K'K4	 t';';<J(;UC
$7?#DNN4KRPP&z3JBOx0T
FOOD!&
'Q>FM
$DeL
v&G**,J
% '
--d3&OO%&??0AG- 11$79,,Z8905G- 11$7-**,-!!!&4+<+<+>+KM??("22 44VW=T=TU 66v>)))$/+/'!%

FOOD!&
'A&&99--"+/'!%

FOOD!&
'stA.J.;J.J+I3<,J(J: JJ
+BJJ.3I=8JJ
J
JJJ++J..Kc0|jxs
t}|jr[|jj\}}}|j	|5|j
|g|i|ddd|jr[|jS#1swY"xYw)zNExecute all cleanup functions. Normally called for you after
        tearDown.N)rrrr]r/r>r )r"rHrVrWrXs     rrFzTestCase.doCleanupss---8:nn%)^^%7%7%9"HdF))$/
=!!!(<T<V<
=nn
=
=sBBcg|_|jr5|jj\}}}	||i||jr4yy#t$r0|jj	tjYGwxYw)zYExecute all class cleanup functions. Normally called for you after
        tearDownClass.N)tearDown_exceptionsrr]r^rUr)r*rs    rdoClassCleanupszTestCase.doClassCleanupssx#%!!%(%8%8%<%<%>"HdF
?$)&)!!
?''..s||~>
?sA

6BBc&|j|i|Sr0)rJ)r"rWkwdss   r__call__zTestCase.__call__stxx&&&rct||j}t|jdds
t|ddr1t|jddxs
t|dd}t||j	|j||j
|jrB|jj\}}}|j|g|i||jrAyy)z6Run the test without collecting errors in a TestResultrjFrkrnN)
r6rrrr4r:r<rr]r>)r"rrGrVrWrXs      rdebugzTestCase.debugsT4#7#78
DNN$7?J 3U;0GLL":/FK
8$$Z(nn%)^^%7%7%9"HdFDh888nnrct|)zSkip this test.re)r"r;s  rskipTestzTestCase.skipTests
vrc$|j|)z)Fail immediately, with the given message.)r>)r"rs  rfailz
TestCase.fails##C((rcf|r/|j|dt|z}|j|y)z#Check that the expression is false.z%s is not falseNrrr>r"exprrs   rassertFalsezTestCase.assertFalses7%%c+<y+NOC'',,rcf|s/|j|dt|z}|j|y)z"Check that the expression is true.z%s is not trueNrYrZs   r
assertTruezTestCase.assertTrues7%%c+;io+MNC'',,rc|js|xs|S||S	|d|S#t$rt|dt|cYSwxYw)aHonour the longMessage attribute when generating failure messages.
        If longMessage is False this means:
        * Use only an explicit message if it is provided
        * Otherwise use the standard message for the assert

        If longMessage is True:
        * Use the standard message
        * If an explicit message is provided, plus ' : ' and the explicit message
        z : )longMessageUnicodeDecodeErrorr)r"rrs   rrzTestCase._formatMessages[%+%;	I!,S11!	I!*;!73HH	Is"AAcTt||}	|jd||d}S#d}wxYw)a=Fail unless an exception of class expected_exception is raised
           by the callable when invoked with specified positional and
           keyword arguments. If a different type of exception is
           raised, it will not be caught, and the test case will be
           deemed to have suffered an error, exactly as for an
           unexpected exception.

           If called with the callable and arguments omitted, will return a
           context object used like this::

                with self.assertRaises(SomeException):
                    do_something()

           An optional keyword argument 'msg' can be provided when assertRaises
           is used as a context object.

           The context manager keeps a reference to the exception as
           the 'exception' attribute. This allows you to inspect the
           exception after the assertion::

               with self.assertRaises(SomeException) as cm:
                   do_something()
               the_exception = cm.exception
               self.assertEqual(the_exception.error_code, 3)
        assertRaisesNrr)r"expected_exceptionrWrXcontexts     rrczTestCase.assertRaisess34''94@	>>.$?GdGs#'c@t||}|jd||S)aFail unless a warning of class warnClass is triggered
           by the callable when invoked with specified positional and
           keyword arguments.  If a different type of warning is
           triggered, it will not be handled: depending on the other
           warning filtering rules in effect, it might be silenced, printed
           out, or raised as an exception.

           If called with the callable and arguments omitted, will return a
           context object used like this::

                with self.assertWarns(SomeWarning):
                    do_something()

           An optional keyword argument 'msg' can be provided when assertWarns
           is used as a context object.

           The context manager keeps a reference to the first matching
           warning as the 'warning' attribute; similarly, the 'filename'
           and 'lineno' attributes give you information about the line
           of Python code from which the warning was triggered.
           This allows you to inspect the warning after the assertion::

               with self.assertWarns(SomeWarning) as cm:
                   do_something()
               the_warning = cm.warning
               self.assertEqual(the_warning.some_attribute, 147)
        assertWarnsrr)r"expected_warningrWrXrfs     rrhzTestCase.assertWarnss$8&&6=~~mT6::rc&ddlm}||||dS)aFail unless a log message of level *level* or higher is emitted
        on *logger_name* or its children.  If omitted, *level* defaults to
        INFO and *logger* defaults to the root logger.

        This method must be used as a context manager, and will yield
        a recording object with two attributes: `output` and `records`.
        At the end of the context manager, the `output` attribute will
        be a list of the matching formatted log messages and the
        `records` attribute will be a list of the corresponding LogRecord
        objects.

        Example::

            with self.assertLogs('foo', level='INFO') as cm:
                logging.getLogger('foo').info('first message')
                logging.getLogger('foo.bar').error('second message')
            self.assertEqual(cm.output, ['INFO:foo:first message',
                                         'ERROR:foo.bar:second message'])
        r_AssertLogsContextFno_logs_logrmr"loggerlevelrms    r
assertLogszTestCase.assertLogs.s*	-!$uEErc&ddlm}||||dS)z Fail unless no log messages of level *level* or higher are emitted
        on *logger_name* or its children.

        This method must be used as a context manager.
        rrlTrnrprrs    rassertNoLogszTestCase.assertNoLogsFs	-!$tDDrct|t|urD|jjt|}|t|trt||}|S|jS)aGet a detailed comparison function for the types of the two args.

        Returns: A callable accepting (first, second, msg=None) that will
        raise a failure exception if first != second with a useful human
        readable error message for those types.
        )rHrgetrgr(r6_baseAssertEqual)r"firstsecondasserters    r_getAssertEqualityFunczTestCase._getAssertEqualityFuncOs[";$v,&0044T%[AH#h,&tX6H$$$rcr||k(s2dt||z}|j||}|j|y)z:The default assertEqual implementation, not type specific.%s != %sN)r	rr>)r"r{r|rrs     rrzzTestCase._baseAssertEqualisC$';E6'JJK%%c;7C'',,rc>|j||}||||y)z[Fail if the two objects are unequal as determined by the '=='
           operator.
        )rN)r~)r"r{r|rassertion_funcs     rassertEqualzTestCase.assertEqualps"44UFCuf#.rc||k7s:|j|t|dt|}|j|y)zYFail if the two objects are equal as determined by the '!='
           operator.
         == NrY)r"r{r|rs    rassertNotEqualzTestCase.assertNotEqualwsI%%c59I:CF:K,MNC'',,rc	~||k(ry|
|tdt||z
}|9||kryt|dt|dt|dt|d}n=|d}t||dk(ryt|dt|d|d	t|d}|j	||}|j|)
a'Fail if the two objects are unequal as determined by their
           difference rounded to the given number of decimal places
           (default 7) and comparing to zero, or by comparing that the
           difference between the two objects is more than the given
           delta.

           Note that decimal places (from zero) are usually not the same
           as significant digits (measured from the most significant digit).

           If the two objects compare equal then they will automatically
           compare almost equal.
        N specify delta or places not bothz !=  within  delta ( difference)rz	 places (rLabsrroundrr>r"r{r|placesrdeltadiffrs        rassertAlmostEqualzTestCase.assertAlmostEqualsF?!3>??56>"u}% &!% $	!K~T6"a'% &!$	!K
!!#{3##C((rc	n|
|tdt||z
}|>||k(s||kDryt|dt|dt|dt|d}n6|d}||k(st||dk7ryt|dt|d|d	}|j	||}|j|)
aFail if the two objects are equal as determined by their
           difference rounded to the given number of decimal places
           (default 7) and comparing to zero, or by comparing that the
           difference between the two objects is less than the given delta.

           Note that decimal places (from zero) are usually not the same
           as significant digits (measured from the most significant digit).

           Objects that are equal automatically fail.
        Nrrrrrrrz placesrrs        rassertNotAlmostEqualzTestCase.assertNotAlmostEquals!3>??56>"VO% &!% $	!K~VOtV)<)A9B59I9B69J9?AK!!#{3##C((rc	|d|j}t||s |jd|dt|t||s"|jd|dt|d}d}	t	|}|	t	|}|||k(ryd|jft||zz}ttD]+}		||	}
	||	}|
|k7s|d|	ft|
|zzz
}n ||k(r|t|t|k7ry||kDr%|d|||z
fzz
}	|d
|t||fzz
}n)||kr$|d|||z
fzz
}	|d
|t||fzz
}|}ddjtjt!j"|j%t!j"|j%z}
|j'||
}|j)||}|j+|y#t
tf$r	d|z}YwxYw#t
tf$r	d|z}YwxYw#t
ttf$r|d	|	|fzz
}YMwxYw#t
ttf$r|d
|	|fzz
}YswxYw#t
ttf$r|d||fzz
}YEwxYw#t
ttf$r|d||fzz
}YjwxYw)aAAn equality assertion for ordered sequences (like lists and tuples).

        For the purposes of this function, a valid ordered sequence type is one
        which can be indexed, has a length, and has an equality operator.

        Args:
            seq1: The first sequence to compare.
            seq2: The second sequence to compare.
            seq_type: The expected datatype of the sequences, or None if no
                    datatype should be enforced.
            msg: Optional message to use on failure instead of a list of
                    differences.
        NzFirst sequence is not a rzSecond sequence is not a sequencez(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
rgr>rlenrLNotImplementedError
capitalizer	rangemin
IndexErrorrHjoindifflibndiffpprintpformat
splitlines_truncateMessagerrW)r"seq1seq2rseq_type
seq_type_name	differinglen1len2iitem1item2rdiffMsgs              rassertSequenceEqualzTestCase.assertSequenceEquals$--MdH-+++8)D/-KLLdH-+++8)D/-KLL'M		#t9D

'4y
t|0"--/1(t456I3tT?+
 GE GEE>"K#$$)=eU)K"K#MNI%
(DLX%5J$t*,d{+.;TD[-IJK	K"A#'4:)>"?#@AI
+.;TD[-IJK	L"A#'4:)>"?#@AI
 MM&...99; ...99;
=>>++KA!!#{3		#K./	#B!#I	#23
'G%'	
'":/BC"N"#]!3#45I":/BC"O"#]!3#45I*":/BCK#259=4I#JKIK":/BCL#36:M5J#KLILsl,H:H H;
I!#J
J,HH H87H8;II!JJJ)(J),K
Kcn|j}|t||kr||zS|tt|zzSr0)maxDiffrDIFF_OMITTED)r"rrmax_diffs    rrzTestCase._truncateMessage3s:<<s4yH4T>!,T233rc6|j|||ty)aA list-specific equality assertion.

        Args:
            list1: The first list to compare.
            list2: The second list to compare.
            msg: Optional message to use on failure instead of a list of
                    differences.

        rN)rr)r"list1list2rs    rrzTestCase.assertListEqual9s	
  sT Brc6|j|||ty)aA tuple-specific equality assertion.

        Args:
            tuple1: The first tuple to compare.
            tuple2: The second tuple to compare.
            msg: Optional message to use on failure instead of a list of
                    differences.
        rN)rr)r"tuple1tuple2rs    rrzTestCase.assertTupleEqualEs	
  u Erc	|j|}	|j|}ssyg}|r2|j	d|D]}|j	t|r2|j	d|D]}|j	t|dj
|}	|j|j||	y#t$r}|jd|zYd}~d}~wt$r}|jd|zYd}~d}~wwxYw#t$r}|jd|zYd}~d}~wt$r}|jd|zYd}~:d}~wwxYw)aA set-specific equality assertion.

        Args:
            set1: The first set to compare.
            set2: The second set to compare.
            msg: Optional message to use on failure instead of a list of
                    differences.

        assertSetEqual uses ducktyping to support different types of sets, and
        is optimized for sets specifically (parameters must support a
        difference method).
        z/invalid type when attempting set difference: %sNz2first 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	)
differencerLrWrKrUreprrr)
r"set1set2rdifference1r.difference2linesitemrs
          rrzTestCase.assertSetEqualPsO	P//$/K	Q//$/K{LLEF#
)T$Z(
)LLEF#
)T$Z(
)ii&		$%%c;785	MIIG!KLL	PIIJQNOO	P
	MIIG!KLL	QIIKaOPP	QsFCD	DC))D5DD	E$D99E$EE$c||vr;t|dt|}|j|j||yy)zDJust like self.assertTrue(a in b), but with a nicer default message. not found in NrrWrr"member	containerrrs     rassertInzTestCase.assertIn{s@"2;F2C2;I2FHKIId))#{;<#rc||vr;t|dt|}|j|j||yy)zHJust like self.assertTrue(a not in b), but with a nicer default message.z unexpectedly found in Nrrs     rassertNotInzTestCase.assertNotIns@Y;DV;L8A)8LNKIId))#{;<rc||ur;t|dt|}|j|j||yy)zDJust like self.assertTrue(a is b), but with a nicer default message.z is not Nrr"expr1expr2rrs     rassertIszTestCase.assertIss?,5e,<-6u-=?KIId))#{;<rcl||ur0dt|}|j|j||yy)zHJust like self.assertTrue(a is not b), but with a nicer default message.zunexpectedly identical: Nrrs     rassertIsNotzTestCase.assertIsNots4E>:CE:JLKIId))#{;<rc	|j|td|j|td||k7rdt||z}ddjt	j
t
j|jt
j|jz}|j||}|j|j||yy)Nz"First argument is not a dictionaryz#Second argument is not a dictionaryrr	)assertIsInstancerr	rrrrrrrrWr)r"d1d2rrrs      rrzTestCase.assertDictEqualsb$(LMb$(MN
8$';B'CCK499W]]!>>"-88:!>>"-88:&<==D//TBKIId))#{;<
rct|t|}}	tj|}tj|}||k(ryt||}|r[d}|Dcgc]}d|z	}	}dj
|	}
|j||
}|j||}|j|yy#t$rt||}YuwxYwcc}w)a[Asserts that two iterables have the same elements, the same number of
        times, without regard to order.

            self.assertEqual(Counter(list(first)),
                             Counter(list(second)))

         Example:
            - [0, 1, 1] and [1, 0, 1] compare equal.
            - [0, 0, 1] and [0, 1] compare unequal.

        NzElement counts were not equal:
z First has %d, Second has %d:  %rr	)
rcollectionsCounterrrLrrrrrW)r"r{r|r	first_seq
second_seqdifferencesrrrrs           rassertCountEqualzTestCase.assertCountEquals!%UT&\:			F''	2E ((4F
.y*EK<KKVW47$>WEWii&G//WEK%%c;7CIIcN
	I1)ZHK	IXs*B2C
2C
	C
c|j|td|j|td||k7rt||jkDst||jkDr|j	||||}|}|r|r|ddk7s|ddk7r*|dz
}|dz
}n|r|ddk7r|dz
}n|r
|ddk7r|dz
}|jd}|jd}dt
||z}ddjtj||z}	|j||	}|j|j||y	y	)
z-Assert that two multi-line strings are equal.zFirst argument is not a stringzSecond argument is not a stringr	T)keependsrrnN)
rr(r_diffThresholdrzrr	rrrrrWr)
r"r{r|rfirst_presplitsecond_presplit
firstlinessecondlinesrrs
          rrzTestCase.assertMultiLineEqualsYeS*JKfc+LMF?E
T000Fd111%%eVS9#N$O9$r
d(:"d*N#t+OF2J$.4'59,$&'22D2AJ)44d4CK%';E6'JJK"'''--
K"HIID//TBKIId))#{;<9rc||ks;t|dt|}|j|j||yy)zCJust like self.assertTrue(a < b), but with a nicer default message.z not less than Nrr"abrrs     r
assertLesszTestCase.assertLesss91u3<Q<1NKIId))#{;<rc||ks;t|dt|}|j|j||yy)zDJust like self.assertTrue(a <= b), but with a nicer default message.z not less than or equal to Nrrs     rassertLessEqualzTestCase.assertLessEquals:Av?H|YWX\ZKIId))#{;<rc||kDs;t|dt|}|j|j||yy)zCJust like self.assertTrue(a > b), but with a nicer default message.z not greater than Nrrs     r
assertGreaterzTestCase.assertGreaters91u6?lIaLQKIId))#{;<rc||k\s;t|dt|}|j|j||yy)zDJust like self.assertTrue(a >= b), but with a nicer default message.z not greater than or equal to Nrrs     rassertGreaterEqualzTestCase.assertGreaterEquals<AvBKA,PYZ[P\]KIId))#{;<rch|0t|d}|j|j||yy)zCSame as self.assertTrue(obj is None), with a nicer default message.Nz is not Nonerr"rCrrs    rassertIsNonezTestCase.assertIsNones1?.7n>KIId))#{;<rcP|$d}|j|j||yy)z(Included for symmetry with assertIsNone.Nzunexpectedly None)rWrrs    rassertIsNotNonezTestCase.assertIsNotNones*;-KIId))#{;<rct||s2t|d|}|j|j||yy)zTSame as self.assertTrue(isinstance(obj, cls)), with a nicer
        default message.z is not an instance of NrgrrWrr"rCrOrrs     rrzTestCase.assertIsInstance	s:#s#;DS>3OKIId))#{;<$rct||r2t|d|}|j|j||yy)z,Included for symmetry with assertIsInstance.z is an instance of Nrrs     rassertNotIsInstancezTestCase.assertNotIsInstances8c37@~sKKIId))#{;< rcBt|||}|jd||S)aAsserts that the message in a raised exception matches a regex.

        Args:
            expected_exception: Exception class expected to be raised.
            expected_regex: Regex (re.Pattern object or string) expected
                    to be found in error message.
            args: Function to be called and extra positional args.
            kwargs: Extra kwargs.
            msg: Optional message used in case of failure. Can only be used
                    when assertRaisesRegex is used as a context manager.
        assertRaisesRegexrd)r"rerrWrXrfs      rrzTestCase.assertRaisesRegexs'''94P~~14@@rcBt|||}|jd||S)aAsserts that the message in a triggered warning matches a regexp.
        Basic functioning is similar to assertWarns() with the addition
        that only warnings whose messages also match the regular expression
        are considered successful matches.

        Args:
            expected_warning: Warning class expected to be triggered.
            expected_regex: Regex (re.Pattern object or string) expected
                    to be found in error message.
            args: Function to be called and extra positional args.
            kwargs: Extra kwargs.
            msg: Optional message used in case of failure. Can only be used
                    when assertWarnsRegex is used as a context manager.
        assertWarnsRegexri)r"rjrrWrXrfs      rrzTestCase.assertWarnsRegex&s' &&6nM~~0$??rct|ttfrtj|}|j|s5d|jd|}|j||}|j|y)z=Fail the test unless the text matches the regular expression.zRegex didn't match: rN)	rgr(bytesrrrrrr>)r"textrrrs     rassertRegexzTestCase.assertRegex9shnsEl3ZZ7N$$T*&&.K%%c;7C'',,+rc.t|ttfrtj|}|j|}|rWd||j
|jd|jd|}|j||}|j|y)z9Fail the test if the text matches the regular expression.zRegex matched: z	 matches z in N)rgr(rrrrstartendrrr>)r"runexpected_regexrmatchrs      rassertNotRegexzTestCase.assertNotRegexEs&e5!zz*:; ''-U[[]UYY[1 ((K
%%c;7C'',,r)rr0)NNNNN)Ur
rrrAssertionErrorr>r`rrrr#rrrrrrrrrrrrrrrrrr!r1r2_subtest_msg_sentinelr,r+r.r2r4r:r<r>rJrFrNrQrSrUrWr\r^rrcrhrurwr~rzrrrrrrrrrrrrrrrrrrrrrrrrrrrr
__classcell__rs@rrrYs@&KGN3>@
683==
77

VVaa#CJ=8e@/##</
''U
"?B	?	?'9")--I*B;>F0E%4-/-AE $+)ZDH#'!)FaF4
C	F)9V====
=@!=F========A @&
--rrcZeZdZdZdfd	ZdZdZdZdZdZ	dZ
d	Zd
ZdZ
xZS)
FunctionTestCaseaIA test case that wraps a test function.

    This is useful for slipping pre-existing test functions into the
    unittest framework. Optionally, set-up and tidy-up functions can be
    supplied. As with TestCase, the tidy-up ('tearDown') function will
    always be called if the set-up ('setUp') function ran successfully.
    cbtt|||_||_||_||_yr0)rrr#
_setUpFunc
_tearDownFunc	_testFunc_description)r"testFuncrrdescriptionrs     rr#zFunctionTestCase.__init__^s/
.0%!'rc>|j|jyyr0)rrs rrzFunctionTestCase.setUpes??&OO'rc>|j|jyyr0)rrs rrzFunctionTestCase.tearDownis) *rc$|jyr0)rrs rrzFunctionTestCase.runTestmsrc.|jjSr0)rr
rs rrzFunctionTestCase.idps~~&&&rct||jstS|j|jk(xrO|j|jk(xr4|j
|j
k(xr|j|jk(Sr0)rgrrrrrrrs  rrzFunctionTestCase.__eq__ssv%0!!%"2"227!!U%8%887~~07  E$6$66	7rctt||j|j|j|j
fSr0)rrHrrrrrs rrzFunctionTestCase.__hash__|s7T$Z$2D2D^^T%6%689	9rc`t|jd|jjdS)Nrr)rrrr
rs rrzFunctionTestCase.__str__s%$T^^4 NN335	5rcNdt|jd|jdS)Nrz tec=r )rrrrs rr!zFunctionTestCase.__repr__s ( 8%)^^5	5rc|j|jS|jj}|xr"|jddj	xsdS)Nr	r)rrrrr
rs  rrz!FunctionTestCase.shortDescriptionsO($$$nn$$1syyq)//19T9rr)r
rrrr#rrrrrrrr!rrrs@rrrUs:(!'7955:rrc<eZdZfdZdZdZdZdZdZxZ	S)r%cnt|||_||_||_|j
|_yr0)rr#_messager%r#r>)r"r%rr#rs    rr#z_SubTest.__init__s1

" ) : :rctd)Nzsubtests cannot be run directly)rrs rrz_SubTest.runTests!"CDDrc`g}|jtur*|jdj|j|jrPdjd|jj
D}|jdj|dj|xsdS)Nz[{}]z, c3FK|]\}}dj||yw)z{}={!r}N)r)r~rrs   rrz+_SubTest._subDescription.<locals>.<genexpr>s)$3Q  A&$3s!z({}) z(<subtest>))r%rrUrr#ritems)r"partsparams_descs   r_subDescriptionz_SubTest._subDescriptions== 55LLt}}56;;))$3"kk//1$33K
LL{34xx/-/rcrdj|jj|jSNz{} {})rr%rr-rs rrz_SubTest.ids)~~dnn//143G3G3IJJrc6|jjS)zlReturns a one-line description of the subtest, or None if no
        description has been provided.
        )r%rrs rrz_SubTest.shortDescriptions~~..00rcVdj|j|jSr/)rr%r-rs rrz_SubTest.__str__s ~~dnnd.B.B.DEEr)
r
rrr#rr-rrrrrs@rr%r%s$;E	0K1Frr%)3rr)rhrrrr7rr1rrDrornrutilrrrrr	
__unittestobjectrrr^rrrrr'r+rDrRrTrYr[rarqrvrxr!r}rrrrChainMaprrrr%rrr<module>r6s4

	??
7y)
&8v&8R%,6
0

 (I
33'3'T$83$8N1D21Dh{++x-vx-x7:x7:t!Fx!Fr