eSrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSK r SSK r SSK r SSK J r SSKJrJrJrJrJr Sr\"5rSr"SS \5r"S S \5r"S S \5r"SS\5rSrSrSrSr /r!Sr"Sr#Sr$Sr%Sr&Sr'Sr(Sr)"SS5r*"SS\*5r+"S S!\+5r,"S"S#\+5r-"S$S%\-5r."S&S'\R^5r0"S(S)\5r1"S*S+\15r2"S,S-\15r3g).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.c\rSrSrSrSrg)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____firstlineno____doc____static_attributes__r 3/opt/imh/python3.13/lib/python3.13/unittest/case.pyr r srr c\rSrSrSrSrg) _ShouldStop"z The test should stop. r Nrr rrrr"rrc\rSrSrSrSrg)_UnexpectedSuccess'z/ The test was supposed to fail, but it didn't! r Nrr rrrr'rrrcF\rSrSrSSjr\R SSj5rSrg)_Outcome-Nc\SUlXl[US5UlSUlSUlg)NF addSubTestT)expecting_failurerhasattrresult_supports_subtestssuccessexpectedFailure)selfrs r__init___Outcome.__init__.s-!& (/ (E% #rc## URnSUlSv U(a8UR(a'URRURUS5 UR=(a UUlg![a e[ a1nSUl[ URU[U55 SnAN[SnAf[a Nj [R"5nUR(aXPl OKSUlU(a'URRURX5 O[URX5 SnN=f!UR=(a UUlf=f7f)NTF)r&rr" test_caseKeyboardInterruptr _addSkipstrrsysexc_infor#r' _addError)r(r,subTest old_successer1s rtestPartExecutor_Outcome.testPartExecutor5sll   8 ,4<< &&y':':ItL<<7KDL1!   5 DL T[[)SV 4 4   ||~H%%'/$$ KK**9+>+> Tdkk9?H  <<7KDLsLE#A5?EE#5E 'B50E5 EEA;E?EE  E#)r'r#rr%r&N)F) rrrrr) contextlibcontextmanagerr6rr rrrr-s!$88rrc[USS5nUb U"X5 g[R"S[S5 UR"U5 g)NaddSkipz4TestResult has no addSkip method, skips not reported)getattrwarningswarnRuntimeWarning addSuccess)rr,reasonr<s rr.r.Vs@fi.G " L$a ))$rcUbHUbD[USUR5(aUR"X5 gUR"X5 ggg)Nr) issubclassfailureException addFailureaddError)rtestr1s rr2r2_sF h2 hqk4#8#8 9 9   d - OOD + 3rcU$r8r )objs r_idrLfs Jrc[U5nURnURnU"U5nU"X@SSS5 U$![a( [ SUR SUR S35Sef=f)N'.z6' object does not support the context manager protocol)type __enter____exit__AttributeError TypeErrorrr)cm addcleanupclsenterexitrs r_enter_contextrZjs r(CO ||2YFttT* M O!CNN+1S-=-=,>?CDEJN OOs :2A,c2[RXU45 g)zjSame as addCleanup, except the cleanup items are called even if setUpModule fails (unlike tearDownModule).N)_module_cleanupsappend)functionargskwargss raddModuleCleanuprazsXV45rc"[U[5$)z&Same as enterContext, but module-wide.)rZra)rUs renterModuleContextrcs ". //rc/n[(a-[R5upnU"U0UD6 [(aM-U(aUSeg![anURU5 SnAN:SnAff=f)zSExecute all module cleanup functions. Normally called for you after tearDownModule.Nr)r\pop Exceptionr]) exceptionsr^r_r`excs rdoModuleCleanupsrisuJ  !1!5!5!7 # d %f %   m #   c " " #sA A-A((A-cj^U4Sjn[T[R5(a TnSmU"U5$U$)z Unconditionally skip a test. c>[U[5(d![R"U5U4Sj5nUnSUlTUlU$)Nc>[T5er8r )r_r`rCs r skip_wrapper-skip..decorator..skip_wrappersv&&rT) isinstancerP functoolswraps__unittest_skip____unittest_skip_why__) test_itemrnrCs r decoratorskip..decoratorsF)T** __Y ' '( '$I&* #*0 'r)rptypes FunctionType)rCrvrus` rskipr{s8 &%,,-- ## rc2U(a [U5$[$)z' Skip a test if the condition is true. r{rL conditionrCs rskipIfrsF| Jrc2U(d [U5$[$)z+ Skip a test unless the condition is true. r}r~s r skipUnlessrs F| JrcSUlU$)NT)__unittest_expecting_failure__)rus rr'r's/3I, rc^[U[5(a[U4SjU55$[U[5=(a [ UT5$)Nc3<># UHn[UT5v M g7fr8) _is_subtype).0r5basetypes r _is_subtype..s>X;q(++Xs)rptupleallrPrE)expectedrs `rrrs:(E"">X>>> h % H*Xx*HHrc \rSrSrSrSrSrg)_BaseTestCaseContextcXlgr8r,)r(r,s rr)_BaseTestCaseContext.__init__s"rcURRURU5nURRU5er8)r,_formatMessagemsgrF)r( standardMsgrs r _raiseFailure"_BaseTestCaseContext._raiseFailures1nn++DHHkBnn--c22rrN)rrrrr)rrr rrrrs #3rrc$\rSrSrSSjrSrSrg)_AssertRaisesBaseContextNc[RX5 XlX lUb[R "U5nX0lSUlSUlgr8) rr)rr,recompileexpected_regexobj_namer)r(rr,rs rr)!_AssertRaisesBaseContext.__init__sB%%d6 "  %ZZ7N, rc[URUR5(d[U<SUR<35eU(dCUR SS5UlU(a![[[U55<S35eUSn$UtpBURUl U U"U0UD6 SSS5 Sng![a [U5Ul N2f=f!,(df  N1=f!Snf=f)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) rr _base_typerT_base_type_strrernextiterrrrSr/)r(namer_r` callable_objs rhandle_AssertRaisesBaseContext.handles t}}doo>>!%t':':!<==!::eT2#7;DL7I%LMMD#' L 2 , 5 5 d-f-D " 2 #L 1  2DsNBC) C)B8"C)$ C-C)8CC)CC) C&"C))C-)rrrrr,r8)rrrrr)rrr rrrrs rrcP\rSrSrSr\rSrSrSr \ "\ R5r Srg)_AssertRaisesContextzCA context manager used to implement TestCase.assertRaises* methods.z-an exception type or tuple of exception typescU$r8r r(s rrQ_AssertRaisesContext.__enter__s rcUcuURRnUR(a,UR SR UUR55 O7UR SR U55 O[R"U5 [XR5(dgURS5Ul URcgURnUR[U55(d4UR SR UR[U555 g![a [UR5nGN5f=f)Nz{} not raised by {}z {} not raisedFT"{}" does not match "{}")rrrSr/rrformat traceback clear_framesrEwith_traceback exceptionrsearchpattern)r(exc_type exc_valuetbexc_namers rrR_AssertRaisesContext.__exit__s   .==11}}""#8#?#?@D $OP""?#9#9(#CD  " "2 &(MM22"11$7    &,,$$S^44   9@@#++S^ = >+" .t}}- .sD..EE)rN)rrrrr BaseExceptionrrrQrR classmethodry GenericAlias__class_getitem__rr rrrrs,MJDN6$E$6$67rrc,\rSrSrSr\rSrSrSr Sr g)_AssertWarnsContextizBA context manager used to implement TestCase.assertWarns* methods.z(a warning type or tuple of warning typescJ[[RR55Hn[ USS5(dM0UlM [ R"SS9UlURR5Ul[ R"SUR5 U$)N__warningregistry__T)recordalways) listr0modulesvaluesr>rr?catch_warningswarnings_managerrQ simplefilterr)r(vs rrQ_AssertWarnsContext.__enter__!s|ckk((*+Aq/66(*%,!) 7 7t D--779 h 6 rc>URRXU5 UbgURRnSnUR HnURn[XpR5(dM+UcUnURb+URR[ U55(dMhXpl URUl URUl g Ub>URSRURR [ U555 UR"(a,URSRUUR"55 gURSRU55 g![a [ UR5nGNcf=f)Nrz{} not triggered by {}z{} not triggered)rrRrrrSr/r?messagerprrwarningfilenamelinenorrrr)r(rrrrfirst_matchingmws rrR_AssertWarnsContext.__exit__,s] &&xB?    *}}--HA Aa//%!"##/''..s1v66LJJDM((DK   %   9@@((00#n2E G H ==   7>>x?C}} N O   188B C3 *4==)H *sE99FF)rrrr?rN) rrrrrWarningrrrQrRrr rrrrsLJ?N  Drrc\rSrSrSrSrg)_AssertNotWarnsContextiOcZURRXU5 UbgURRnUR H?nURn[X`R5(dM+URUS35 MA g![a [ UR5nNqf=f)Nz triggered) rrRrrrSr/r?rrpr)r(rrrrrrs rrR_AssertNotWarnsContext.__exit__Qs &&xB?    *}}--HA A!]]++""hZz#:; *4==)H *sBB*)B*r N)rrrrrRrr rrrrOs \ 4Sj5r!Sr"Sr#Sr$Sr%Sr&Sr'S r(SPS!jr)S"r*\S#5r+S$r,S%r-S&r.SPS'jr/SPS(jr0SPS)jr1S*r2S+r3S,r4S-r5SQS.jr6SQS/jr7S0r8SPS1jr9SPS2jr:SPS3jr;SRS4jr<SRS5jr=SQS6jr>S7r?SPS8jr@SPS9jrASPS:jrBSPS;jrCSPS<jrDSPS=jrESPS>jrFSPS?jrGSPS@jrHSPSAjrISPSBjrJSPSCjrKSPSDjrLSPSEjrMSPSFjrNSPSGjrOSPSHjrPSPSIjrQSJrRSKrSSPSLjrTSPSMjrUSNrVU=rW$)STestCaseijaA 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. TiicB>SUl/Ul[TU] "U0UD6 g)NF)_classSetupFailed_class_cleanupssuper__init_subclass__)rWr_r` __class__s rrTestCase.__init_subclass__s% %  !4262rcXlSUlSUl[X5nURUl/UlSUl 0Ul UR[S5 UR[S5 UR[S5 UR[S 5 UR[ S 5 UR["S 5 g![ a& US:wa[ SUR<SU<35eNf=f) 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_testMethodDocr>rrS ValueErrorr _cleanups_subtest_type_equality_funcsaddTypeEqualityFuncdictrrr frozensetr/)r( methodName testMethods rr)TestCase.__init__s * ' 5 2J#-"4"4D  %'!   '89   '89   (:;   &67   ,<=   &<=) 4Y&!~~z"344' 4s C -C<;C<c X RU'g)aAdd 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(typeobjr^s rrTestCase.addTypeEqualityFuncs.6!!'*rc>URRXU45 g)zAdd 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)rr]r(r^r_r`s r addCleanupTestCase.addCleanups xv67rc,[XR5$)zEnters the supplied context manager. If successful, also adds its __exit__ method as a cleanup function and returns the result of the __enter__ method. )rZr)r(rUs r enterContextTestCase.enterContexts b//22rc>URRXU45 g)zhSame as addCleanup, except the cleanup items are called even if setUpClass fails (unlike tearDownClass).N)rr]rWr^r_r`s raddClassCleanupTestCase.addClassCleanups ""HF#;>2D4H4HIIrcn[U5[U5La[$URUR:H$r8)rPNotImplementedrr(others r__eq__TestCase.__eq__ s/ :T%[ (! !##u'<'<<r:rs r__repr__TestCase.__repr__s"($*>*>@ @rc+v# URbURR(dSv gURnUc [U5nOURR U5n[ XU5UlURRURSS9 Sv SSS5 URR(d1URRnUbUR(a[eO!URR(a[eX0lg!,(df  N=f!X0lf=f7f)a(Return 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)r3) rr%rrparams new_child_SubTestr6r&rfailfastrr')r(rrRparent params_maprs rr3TestCase.subTests ==  (N(N   >)&1J008J J7  #// t/LM==((--%&//%%.."!"MML#Ms7A5D98$D.D!A5D.D9 D+'D..D66D9cURnU"X5 g![a0 [R"S[5 UR "U5 gf=f)Nz@TestResult has no addExpectedFailure method, reporting as passes)addExpectedFailurerSr?r@rArB)r(rr1rZs r_addExpectedFailureTestCase._addExpectedFailure8sN /!'!:!:  t .  $ MM\( *   d # $s 7AAcURnU"U5 g![a[ [R"S[5 [ Se![ a* UR "U[R"55 gf=ff=f)NzCTestResult has no addUnexpectedSuccess method, reporting as failure) addUnexpectedSuccessrSr?r@rArrGr0r1)r(rr^s r_addUnexpectedSuccessTestCase._addUnexpectedSuccessBsr '#)#>#>  ! & 8 MM_( * 8(d2% 8!!$ 7 8 8s& %A<A0A84A<7A88A<cURnU"X5 g![a [R"S[5 gf=f)Nz$TestResult has no addDuration method) addDurationrSr?r@rA)r(relapsedrbs r _addDurationTestCase._addDurationQs? ' ,,K  &  * MM@( * *s %??c$UR5 gr8)rrs r _callSetUpTestCase._callSetUpZs  rcRU"5b[R"SUS3[SS9 gg)NzFIt is deprecated to return a value that is not None from a test case (rI) stacklevel)r?r@DeprecationWarning)r(methods r_callTestMethodTestCase._callTestMethod]s3 8  MM((.xq23ERS U rc$UR5 gr8)r rs r _callTearDownTestCase._callTearDownbs  rcU"U0UD6 gr8r rs r _callCleanupTestCase._callCleanupes$!&!rcUc5UR5n[USS5n[USS5nUbU"5 OSnUR"U5 [XR5n[URSS5(d[USS5(aV[URSS5=(d [USS5n[ XU5 UUR "U5 UbU"5 $$[USS5=(d [USS5n[U5n[R"5nXpl URU5 UR5 SSS5 UR(abXglURU5 URU5 SSS5 SUlURU5 UR!5 SSS5 UR#5 UR%U[R"5U- 5 UR(aXU(a?UR&(aUR)XR&5 O$UR+U5 OUR,"U5 USUlSnSUl UR "U5 UbU"5 $$!,(df  GNR=f!,(df  GN"=f!,(df  GN=f!SUlSnSUl f=f!UR "U5 UbU"5 ff=f)N startTestRun stopTestRunrsFrtrxr)r/r> startTestrrr.stopTestrtime perf_counterrr6rgr&r#rnrq doCleanupsrdr'r[r_rB) r(rrwrxrskip_whyr#outcome start_times rrun TestCase.runhs >++-F"6>4@L!&->K'K4  ';';FM $DeL v&G**,J % ' --d3OO%4??0A- 11$7,,Z8805G- 11$7**,8!!!&4+<+<+>+KM??("22 44V=T=TU 66v>))$/+/'!%  OOD !& 'A438787"+/'!%  OOD !& 'suA;K''AK')KJ0KJ. K3KB*K.K' J+&K. J=8K K KK$$K''LcXUR=(d [5nUR(a`URR5up#nUR U5 UR "U/UQ70UD6 SSS5 UR(aM`UR $!,(df  N-=f)zFExecute all cleanup functions. Normally called for you after tearDown.N)rrrrer6rtr&)r(rr^r_r`s rr}TestCase.doCleanupss}---8:nn%)^^%7%7%9 "HF))$/!!( "HF ?$)&)!!! ?''..s||~> ?sA8BBc&UR"U0UD6$r8)r)r(r_kwdss r__call__TestCase.__call__sxx&&&rc[XR5n[URSS5(d[USS5(a6[URSS5=(d [USS5n[U5eUR 5 UR U5 UR 5 UR(aGURR5up4nUR"U/UQ70UD6 UR(aMFgg)z6Run the test without collecting errors in a TestResultrsFrtrxN) r>rrr rgrnrqrrert)r(rr~r^r_r`s rdebugTestCase.debugsT#7#78 DNN$7 ? ? J 3U ; ;0GLL":/FK 8$ $  Z( nn%)^^%7%7%9 "HF   h 8 8 8nnnrc[U5e)zSkip this test.rm)r(rCs rskipTestTestCase.skipTests vrc$URU5e)z)Fail immediately, with the given message.)rF)r(rs rfail TestCase.fails##C((rcpU(a/URUS[U5-5nURU5eg)z#Check that the expression is false.z%s is not falseNrrrFr(exprrs r assertFalseTestCase.assertFalses7 %%c+>.$?GdGs!%c<[X5nURSX#5$)a Fail 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) assertWarnsrrr(expected_warningr_r`rs rrTestCase.assertWarns s 8&&6=~~mT::rc<[X5nURSX#5$)z7The opposite of assertWarns. Private due to low demand._assertNotWarns)rrrs rrTestCase._assertNotWarns?s()9@~~/>>rcSSKJn U"XUSS9$)a&Fail 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_logrr(loggerlevelrs r assertLogsTestCase.assertLogsDs* -!$uEErcSSKJn U"XUSS9$)zFail 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. rrTrrrs r assertNoLogsTestCase.assertNoLogs\s -!$tDDrc[U5[U5LaIURR[U55nUb"[U[5(a [ X5nU$UR $)zGet 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. )rPrgetrpr/r>_baseAssertEqual)r(firstsecondasserters r_getAssertEqualityFuncTestCase._getAssertEqualityFunces\" ;$v, &0044T%[AH#h,,&t6H$$$rcnX:Xd0S[X5-nURX45nURU5eg)z:The default assertEqual implementation, not type specific.%s != %sN)r rrF)r(rrrrs rrTestCase._baseAssertEquals=$';E'JJK%%c7C'', ,rc4URX5nU"XUS9 g)zHFail if the two objects are unequal as determined by the '==' operator. )rN)r)r(rrrassertion_funcs r assertEqualTestCase.assertEquals44UCu#.rcX:wd<URU[U5<S[U5<35nURU5eg)zFFail if the two objects are equal as determined by the '!=' operator.  == Nr)r(rrrs rassertNotEqualTestCase.assertNotEqualsG%%c59I:CF:K,MNC'', ,rc X:XagUbUb [S5e[X- 5nUb=Xe::ag[U5<S[U5<S[U5<S[U5<S3nOBUcSn[Xc5S:Xag[U5<S[U5<SU<S [U5<S3nUR XG5nUR U5e) aFail 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 (rTabsrroundrrFr(rrplacesrdeltadiffrs rassertAlmostEqualTestCase.assertAlmostEquals ?   !3>? ?5>"  }% &!% $ !K ~T"a'% &!$ !K !!#3##C((rc UbUb [S5e[X- 5nUbBX:XdXe:ag[U5<S[U5<S[U5<S[U5<S3nO:UcSnX:Xd[Xc5S:wag[U5<S[U5<SU<S 3nUR XG5nUR U5e) 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 rassertNotAlmostEqualTestCase.assertNotAlmostEquals  !3>? ?5>"  O% &!% $ !K ~Ot)<)A9B59I9B69J9?AK!!#3##C((rc UbqURn[X5(d"URSU<S[U5<35e[X$5(d"URSU<S[U5<35eOSnSn[ U5nUc [ U5nUcX:XagSUR54[X5--n[[WW55H)n Xn X)n X:wdMUS U 4[X5--- n O# Xx:XaUc[U5[U5:wagXx:a#US XWU- 4-- nUS U[X54-- nO'Xx:a"USXXU- 4-- nUS U[X'54-- nUn SSR[R"[ R""U5R%5[ R""U5R%555-n UR'X5n UR)X<5nUR+U5 g![ [ 4a SU-nGNf=f![ [ 4a SU-nGNf=f![ [[ 4a US X4-- n GMMf=f![ [[ 4a US X4-- n GMtf=f![ [[ 4a USX4-- nGNJf=f![ [[ 4a USXu4-- nGNof=f)aAn 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 r2)rrprFrlenrTNotImplementedError capitalizer rangemin IndexErrorrPjoindifflibndiffpprintpformat splitlines_truncateMessagerr)r(seq1seq2rseq_type seq_type_name differinglen1len2iitem1item2rdiffMsgs rassertSequenceEqualTestCase.assertSequenceEquals  $--Md--+++8)D/-KLLd--+++8)D/-KLL.'M  #t9D   '4y  |0"--/1(456I3tT?+ GE  GE >"K#$$)=e)K"K#MNI%,(LX%5J$t*,{+.;D[-IJK K"A#'4:)>"?#@AI +.;D[-IJK L"A#'4:)>"?#@AI   MM&...99; ...99; =>>++KA !!#3 #K./ #B!#I #23 'G%'  '":/BC"N"#!3#45I":/BC"O"#!3#45I*":/BCK#2594I#JKIK":/BCL#36:5J#KLILsl: H H.I I12JJ=H+*H+.II I.-I.1JJJ:9J:=KKcpURnUb[U5U::aX-$U[[U5--$r8)maxDiffr DIFF_OMITTED)r(rrmax_diffs rrTestCase._truncateMessageIs8<<  s4yH4> !,T233rc.URXU[S9 g)zA 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 rrTestCase.assertListEqualOs   sT Brc.URXU[S9 g)zA 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 rrTestCase.assertTupleEqual[s   u ErcURU5nURU5nW(dW(dg/nU(a4UR S5 UHnUR [ U55 M W(a4UR S5 UHnUR [ U55 M SR U5n URURX955 g![anURSU-5 SnANSnAf[anURSU-5 SnAGNSnAff=f![anURSU-5 SnAGN/SnAf[anURSU-5 SnAGNVSnAff=f)agA 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:r2) differencerTrrSr]reprrr) r(set1set2r difference1r5 difference2linesitemrs rrTestCase.assertSetEqualfsC P//$/K  Q//$/K {   LLE F# T$Z($  LLE F# T$Z($ii&  $%%c785 M IIG!K L L P IIJQN O O P  M IIG!K L L Q IIKaO P P QsFCD0 D-(D D-D((D-0 F:E F!E;;FcX;a<[U5<S[U5<3nURURX455 gg)zDJust like self.assertTrue(a in b), but with a nicer default message. not found in Nrrrr(member containerrrs rassertInTestCase.assertIns<  "2;F2C2;I2FHK IId))#; < #rcX;a<[U5<S[U5<3nURURX455 gg)zHJust like self.assertTrue(a not in b), but with a nicer default message.z unexpectedly found in Nrrs r assertNotInTestCase.assertNotIns<  ;DV;L8A)8LNK IId))#; < rcXLa<[U5<S[U5<3nURURX455 gg)zDJust like self.assertTrue(a is b), but with a nicer default message.z is not Nrr(expr1expr2rrs rassertIsTestCase.assertIss;  ,5e,<-6u-=?K IId))#; < rclXLa0S[U5<3nURURX455 gg)zHJust like self.assertTrue(a is not b), but with a nicer default message.zunexpectedly identical: Nrr&s r assertIsNotTestCase.assertIsNots0 >:CE:JLK IId))#; < rc URU[S5 URU[S5 X:waS[X5-nSSR[R "[ R"U5R5[ R"U5R555-nURXE5nURURX455 gg)Nz"First argument is not a dictionaryz#Second argument is not a dictionaryrr2) assertIsInstancerr rrrrrrrrr)r(d1d2rrrs rrTestCase.assertDictEquals b$(LM b$(MN 8$';B'CCK499W]]!>>"-88:!>>"-88:&<==D// BK IId))#; < rc[U5[U5pT[R"U5n[R"U5nX:Xag[XE5nU(a\SnUVs/sHnSU-PM n nSR U 5n URXz5nURX75nURU5 gg![a [ XE5nN{f=fs snf)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: %rr2) r collectionsCounterrrTrrrrr) r(rrr first_seq second_seq differencesrrrrs rassertCountEqualTestCase.assertCountEquals!%U T&\: F'' 2E ((4F .yEK ;EWii&G// EK%%c7C IIcN  I1)HK IXs,B8!C8CCcURU[S5 URU[S5 X:wGa$[U5UR:d[U5UR:aUR XU5 UnUnU(a$U(aUSS:wd USS:wa US- nUS- nO+U(aUSS:waUS- nOU(aUSS:waUS- nUR SS9nUR SS9nS[ X5-nSSR[R"Xg55-n URX5nURURX855 g g ) z-Assert that two multi-line strings are equal.zFirst argument is not a stringzSecond argument is not a stringr2T)keependsrrxN) r/r/r_diffThresholdrrr rrrrrr) r(rrrfirst_presplitsecond_presplit firstlines secondlinesrrs rrTestCase.assertMultiLineEqualsN eS*JK fc+LM ?E T000F d111%%eS9 #N$O9$r d(:"d*N#t+OF2J$.4'59,$&'22D2AJ)44d4CK%';E'JJK"'''-- "HIID// BK IId))#; <9 rcX:d<[U5<S[U5<3nURURX455 gg)zCJust like self.assertTrue(a < b), but with a nicer default message.z not less than Nrr(abrrs r assertLessTestCase.assertLesss5u3 b), but with a nicer default message.z not greater than NrrEs r assertGreaterTestCase.assertGreaters5u6?lIaLQK IId))#; <rcX:d<[U5<S[U5<3nURURX455 gg)zDJust like self.assertTrue(a >= b), but with a nicer default message.z not greater than or equal to NrrEs rassertGreaterEqualTestCase.assertGreaterEqual s8vBKA,PYZ[P\]K IId))#; <rcjUb0[U5<S3nURURX#55 gg)zCSame as self.assertTrue(obj is None), with a nicer default message.Nz is not Nonerr(rKrrs r assertIsNoneTestCase.assertIsNones/ ?.7n>K IId))#; < rcPUc#SnURURX#55 gg)z(Included for symmetry with assertIsNone.Nzunexpectedly None)rrrTs rassertIsNotNoneTestCase.assertIsNotNones( ;-K IId))#; < rc[X5(d3[U5<SU<3nURURX455 gg)zLSame as self.assertTrue(isinstance(obj, cls)), with a nicer default message.z is not an instance of Nrprrrr(rKrWrrs rr/TestCase.assertIsInstances9###;DS>3OK IId))#; <$rc[X5(a3[U5<SU<3nURURX455 gg)z,Included for symmetry with assertIsInstance.z is an instance of Nr[r\s rassertNotIsInstanceTestCase.assertNotIsInstance&s7 c  7@~sKK IId))#; < rc>[XU5nURSX45$)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. assertRaisesRegexr)r(rrr_r`rs rrbTestCase.assertRaisesRegex,s#''9P~~14@@rc>[XU5nURSX45$)arAsserts 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. assertWarnsRegexr)r(rrr_r`rs rreTestCase.assertWarnsRegex<s# &&6nM~~0$??rc[U[[45(a$U(dS5e[R"U5nUR U5(d6SUR <SU<3nURX45nURU5eg)z=Fail the test unless the text matches the regular expression.z!expected_regex must not be empty.zRegex didn't match: rN) rpr/bytesrrrrrrF)r(textrrrs r assertRegexTestCase.assertRegexOsz nsEl 3 3! F#F F>ZZ7N$$T**&&.K%%c7C'', , +rcF[U[[45(a[R"U5nUR U5nU(aXSXR 5UR5<SUR<SU<3nURX55nURU5eg)z9Fail the test if the text matches the regular expression.zRegex matched: z matches z in N) rpr/rhrrrstartendrrrF)r(riunexpected_regexrmatchrs rassertNotRegexTestCase.assertNotRegex[s &e 5 5!zz*:;  ''- [[]UYY[1 ((K %%c7C'', , r)rrrrrr)rr8)NNNNN)XrrrrrAssertionErrorrFrrr>rr)rrrrrrrr r$r(r+r/r7r;rArErJrOr9r:_subtest_msg_sentinelr3r[r_rdrgrnrqrtrr}rrrrrrrrrrrrrrrrrrrrrrrrr r#r)r,rr9rrHrKrNrQrUrXr/r_rbrerjrqr __classcell__rs@rrrjs @&KGN3 >@ 683== 77  VVaa#CJ= 8e@/##</ ''U "?B  ? ?'9")- - I*B;>? F0E%4-/-AE $+)ZDH#'!)FaF4 C F)9V==== =@!=F= = = = = = == A @& - - -rrcf^\rSrSrSrSU4SjjrSrSrSrSr Sr S r S r S r S rS rU=r$)FunctionTestCaseika5A 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. cZ>[[U] 5 X lX0lXlX@lgr8)rryr) _setUpFunc _tearDownFunc _testFunc _description)r(testFuncrr  descriptionrs rr)FunctionTestCase.__init__ts' .0%!'rc@URbUR5 ggr8)r{rs rrFunctionTestCase.setUp{s ?? & OO  'rc@URbUR5 ggr8)r|rs rr FunctionTestCase.tearDowns    )     *rc$UR5 gr8)r}rs rrFunctionTestCase.runTests  rc.URR$r8)r}rrs rr;FunctionTestCase.ids~~&&&rc4[XR5(d[$URUR:H=(aY URUR:H=(a9 UR UR :H=(a UR UR :H$r8)rprr>r{r|r}r~r?s rrAFunctionTestCase.__eq__sw%00! !%"2"227!!U%8%887~~07  E$6$66 7rc[[U5URURURUR 45$r8)rDrPr{r|r}r~rs rrEFunctionTestCase.__hash__s7T$Z$2D2D^^T%6%689 9rcd[UR5<SURR<S3$)NrHrI)rrr}rrs rrJFunctionTestCase.__str__s%$T^^4 NN335 5rcRS[UR5<SUR<S3$)NrMz tec=rN)rrr}rs rrOFunctionTestCase.__repr__s ( 8%)^^5 5rcURb UR$URRnU=(a" URS5SR 5=(d S$)Nr2r)r~r}rr4r3r5s rr7!FunctionTestCase.shortDescriptionsO    ($$ $nn$$1syyq)//19T9r)r~r{r|r}rs)rrrrrr)rr rr;rArErJrOr7rrvrws@rryryks?(!'7955::rrycF^\rSrSrU4SjrSrSrSrSrSr Sr U=r $) rTich>[TU]5 X lXlX0lUR Ulgr8)rr)_messager,rRrF)r(r,rrRrs rr)_SubTest.__init__s+  " ) : :rc[S5e)Nzsubtests cannot be run directly)rrs rr_SubTest.runTests!"CDDrcv/nUR[La*URSRUR55 UR(aPSR SURR 555nURSRU55 SR U5=(d S$)Nz[{}]z, c3H# UHupSRX5v M g7f)z{}={!r}N)r)rrrs rr+_SubTest._subDescription..s'$31FQ  &&1s "z({}) z ())rrur]rrRritems)r(parts params_descs r_subDescription_SubTest._subDescriptions == 5 5 LLt}}5 6 ;;))$3"kk//1$33K LL{3 4xx/-/rcrSRURR5UR55$Nz{} {})rr,r;rrs rr; _SubTest.ids)~~dnn//143G3G3IJJrc6URR5$)z\Returns a one-line description of the subtest, or None if no description has been provided. )r,r7rs rr7_SubTest.shortDescriptions~~..00rcVSRURUR55$r)rr,rrs rrJ_SubTest.__str__s ~~dnnd.B.B.DEEr)rrFrRr,) rrrrr)rrr;r7rJrrvrws@rrTrTs*;E 0K1 FFrrT)4rr0rqrrrr?r4r9rr{ryrxrutilrrrrr __unittestobjectrurrfr rrrr.r2rLrZr\rarcrir{rrr'rrrrrrChainMaprrryrTr rrrsA   ?? 7 y)  &8v&8R%, 6 0  (I 33'3'T$83$8N1D21Dh<0<"{++}-v}-B 7:x7:t!Fx!Fr