^Rc@s}dZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl m Z ddl m Z mZmZmZmZeZdZdefdYZd efd YZd efd YZd ZdZdZdZdZdZdZde fdYZ!de fdYZ"de"fdYZ#dS(sTest case implementationiNi(tresult(tstrclasst safe_reprtunorderable_list_differencet_count_diff_all_purposet_count_diff_hashables@ Diff is %s characters long. Set self.maxDiff to None to see it.tSkipTestcBseZdZRS(s 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. (t__name__t __module__t__doc__(((s#/usr/lib/python2.7/unittest/case.pyRst_ExpectedFailurecBseZdZdZRS(s\ Raise this when a test is expected to fail. This is an implementation detail. cCs tt|j||_dS(N(tsuperR t__init__texc_info(tselfR ((s#/usr/lib/python2.7/unittest/case.pyR *s(RRR R (((s#/usr/lib/python2.7/unittest/case.pyR #st_UnexpectedSuccesscBseZdZRS(s7 The test was supposed to fail, but it didn't! (RRR (((s#/usr/lib/python2.7/unittest/case.pyR.scCs|S(N((tobj((s#/usr/lib/python2.7/unittest/case.pyt_id4scsfd}|S(s& Unconditionally skip a test. csUt|ttjfs?tj|fd}|}nt|_|_|S(NcstdS(N(R(targstkwargs(treason(s#/usr/lib/python2.7/unittest/case.pyt skip_wrapper=s( t isinstancettypettypest ClassTypet functoolstwrapstTruet__unittest_skip__t__unittest_skip_why__(t test_itemR(R(s#/usr/lib/python2.7/unittest/case.pyt decorator;s    ((RR ((Rs#/usr/lib/python2.7/unittest/case.pytskip7s cCs|rt|StS(s/ Skip a test if the condition is true. (R!R(t conditionR((s#/usr/lib/python2.7/unittest/case.pytskipIfGs cCs|st|StS(s3 Skip a test unless the condition is true. (R!R(R"R((s#/usr/lib/python2.7/unittest/case.pyt skipUnlessOs cs"tjfd}|S(NcsAy||Wn#tk r6ttjnXtdS(N(t ExceptionR tsysR R(RR(tfunc(s#/usr/lib/python2.7/unittest/case.pytwrapperYs  (RR(R'R(((R's#/usr/lib/python2.7/unittest/case.pytexpectedFailureXscCs!dtjkrt|StSdS(s Non-standard/downstream-only decorator for marking a specific unit test to be skipped when run within the %check of an rpmbuild. Specifically, this takes effect when WITHIN_PYTHON_RPM_BUILD is set within the environment, and has no effect otherwise. tWITHIN_PYTHON_RPM_BUILDN(tostenvironR!R(R((s#/usr/lib/python2.7/unittest/case.pyt_skipInRpmBuildfs cs"tjfd}|S(s  Non-standard/downstream-only decorator for marking a specific unit test as expected to fail within the %check of an rpmbuild. Specifically, this takes effect when WITHIN_PYTHON_RPM_BUILD is set within the environment, and has no effect otherwise. cs`dtjkrOy||Wn#tk rEttjnXtn ||dS(NR*(R+R,R%R R&R R(RR(R'(s#/usr/lib/python2.7/unittest/case.pyR({s  (RR(R'R(((R's#/usr/lib/python2.7/unittest/case.pyt_expectedFailureInRpmBuildss t_AssertRaisesContextcBs,eZdZddZdZdZRS(sCA context manager used to implement TestCase.assertRaises* methods.cCs"||_|j|_||_dS(N(texpectedtfailureExceptiontexpected_regexp(RR0t test_caseR2((s#/usr/lib/python2.7/unittest/case.pyR s  cCs|S(N((R((s#/usr/lib/python2.7/unittest/case.pyt __enter__scCs|dkrZy|jj}Wn tk r>t|j}nX|jdj|nt||jsptS||_ |j dkrt S|j }t |t rtj|}n|jt|s|jd|jt|fnt S(Ns{0} not raiseds"%s" does not match "%s"(tNoneR0RtAttributeErrortstrR1tformatt issubclasstFalset exceptionR2RRt basestringtretcompiletsearchtpattern(Rtexc_typet exc_valuettbtexc_nameR2((s#/usr/lib/python2.7/unittest/case.pyt__exit__s&     N(RRR R5R R4RE(((s#/usr/lib/python2.7/unittest/case.pyR/s  tTestCasecBs)eZdZeZeZd@ZdAZeZ ddZ dZ dZ d Z d Zed Zed Zd ZdZdZdZdZdZdZdZdZdZdBdZdZdZdZ dZ!dBdZ"dBdZ#dBdZ$dZ%dBd Z&d!Z'dBd"Z(dBd#Z)dBd$Z*dBdBdBd%Z+dBdBdBd&Z,e)Z-e*Z.e+Z/e,Z0e$Z1d'Z2e2e)Z3e2e*Z4e2e+Z5e2e,Z6e2e$Z7e2e&Z8e2e#Z9dBdBd(Z:d)Z;dBd*Z<dBd+Z=dBd,Z>dBd-Z?dBd.Z@dBd/ZAdBd0ZBdBd1ZCdBd2ZDdBd3ZEdBd4ZFdBd5ZGdBd6ZHdBd7ZIdBd8ZJdBd9ZKdBd:ZLdBd;ZMdBd<ZNdBd=ZOdBd>ZPdBd?ZQRS(CsWA 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. iPiiitrunTestcCs||_d|_yt||}Wn*tk rQtd|j|fnX|j|_g|_ i|_ |j t d|j t d|j td|j td|j tdy|j tdWntk rnXdS(sCreate 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. sno such test method in %s: %stassertDictEqualtassertListEqualtassertTupleEqualtassertSetEqualtassertMultiLineEqualN(t_testMethodNameR5t_resultForDoCleanupstgetattrR6t ValueErrort __class__R t_testMethodDoct _cleanupst_type_equality_funcstaddTypeEqualityFunctdicttlistttupletsett frozensettunicodet NameError(Rt methodNamet testMethod((s#/usr/lib/python2.7/unittest/case.pyR s&       cCs||j|(RRQRM(R((s#/usr/lib/python2.7/unittest/case.pyt__repr__BscCsRt|dd}|dk r.|||n tjdtd|j|dS(NtaddSkips4TestResult has no addSkip method, skips not reportedi(ROR5twarningstwarntRuntimeWarningt addSuccess(RRRRx((s#/usr/lib/python2.7/unittest/case.pyt_addSkipFs    c Csr|}|dkrI|j}t|dd}|dk rI|qIn||_|j|t||j}t|jdtst|dtrz;t|jddpt|dd}|j||Wd|j |XdSz>t}y|j WnXt k r*}|j|t |nt k r=n|j|tjnXy |WnBt k r{n5|jk r|j|tjn tk r}t|dd}|dk r|||jqtjdt|j|ntk ret|dd} | dk r<| |qtjdt|j|tjnKt k r}|j|t |n#|j|tjnXt}y|jWn6t k rn#|j|tjt}nX|j} |o | }|r%|j|nWd|j ||dkrmt|d d} | dk rm| qmnXdS( Nt startTestRunRRttaddExpectedFailures@TestResult has no addExpectedFailure method, reporting as passestaddUnexpectedSuccesssDTestResult has no addUnexpectedSuccess method, reporting as failurest stopTestRun(R5RjRORNt startTestRMRQR:R}tstopTestRcRR7tKeyboardInterrupttaddErrorR&R R1t addFailureR RyRzR{R|RRRdt doCleanups( RRt orig_resultR~R^tskip_whytsuccessteRRtcleanUpSuccessR((s#/usr/lib/python2.7/unittest/case.pytrunOs                      cCs|j}t}xr|jr|jjd\}}}y|||Wqtk r]qt}|j|tjqXqW|S(sNExecute all cleanup functions. Normally called for you after tearDown.i( RNRRStpopRR:RR&R (RRtokR`RR((s#/usr/lib/python2.7/unittest/case.pyRs   cOs|j||S(N(R(RRtkwds((s#/usr/lib/python2.7/unittest/case.pyt__call__scCsc|jt||j|jx5|jr^|jjd\}}}|||q*WdS(s6Run the test without collecting errors in a TestResultiN(RcRORMRdRSR(RR`RR((s#/usr/lib/python2.7/unittest/case.pytdebugs    cCst|dS(sSkip this test.N(R(RR((s#/usr/lib/python2.7/unittest/case.pytskipTestscCs|j|dS(s)Fail immediately, with the given message.N(R1(Rtmsg((s#/usr/lib/python2.7/unittest/case.pytfailscCs8|r4|j|dt|}|j|ndS(s#Check that the expression is false.s%s is not falseN(t_formatMessageRR1(RtexprR((s#/usr/lib/python2.7/unittest/case.pyt assertFalsescCs8|s4|j|dt|}|j|ndS(s"Check that the expression is true.s%s is not trueN(RRR1(RRR((s#/usr/lib/python2.7/unittest/case.pyt assertTruescCsd|js|p|S|dkr#|Syd||fSWn(tk r_dt|t|fSXdS(sHonour 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 s%s : %sN(t longMessageR5tUnicodeDecodeErrorR(RRt standardMsg((s#/usr/lib/python2.7/unittest/case.pyRs    cOs=t||}|dkr|S||||WdQXdS(sFail unless an exception of class excClass is raised by callableObj when invoked with arguments args and keyword arguments kwargs. 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 callableObj omitted or None, will return a context object used like this:: with self.assertRaises(SomeException): do_something() 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) N(R/R5(RtexcClasst callableObjRRtcontext((s#/usr/lib/python2.7/unittest/case.pyt assertRaisess  cCskt|t|krd|jjt|}|dk rdt|tr]t||}n|Sn|jS(sGet 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. N(RRTtgetR5RR<ROt_baseAssertEqual(Rtfirsttsecondtasserter((s#/usr/lib/python2.7/unittest/case.pyt_getAssertEqualityFuncs cCsP||ksLdt|t|f}|j||}|j|ndS(s:The default assertEqual implementation, not type specific.s%s != %sN(RRR1(RRRRR((s#/usr/lib/python2.7/unittest/case.pyRs cCs)|j||}|||d|dS(s[Fail if the two objects are unequal as determined by the '==' operator. RN(R(RRRRtassertion_func((s#/usr/lib/python2.7/unittest/case.pyt assertEqual$scCsJ||ksF|j|dt|t|f}|j|ndS(sYFail if the two objects are equal as determined by the '!=' operator. s%s == %sN(RRR1(RRRR((s#/usr/lib/python2.7/unittest/case.pytassertNotEqual+s cCs||krdS|dk r7|dk r7tdn|dk rt|||kr]dSdt|t|t|f}nW|dkrd}ntt|||dkrdSdt|t||f}|j||}|j|dS(sFail 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 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 signficant digit). If the two objects compare equal then they will automatically compare almost equal. Ns specify delta or places not boths%s != %s within %s deltaiis%s != %s within %r places(R5t TypeErrortabsRtroundRR1(RRRtplacesRtdeltaR((s#/usr/lib/python2.7/unittest/case.pytassertAlmostEqual5s&         cCs |dk r'|dk r'tdn|dk r||k rZt|||krZdSdt|t|t|f}nd|dkrd}n||k rtt|||dkrdSdt|t||f}|j||}|j|dS(sFail 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 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 signficant digit). Objects that are equal automatically fail. s specify delta or places not bothNs%s == %s within %s deltaiis%s == %s within %r places(R5RRRRRR1(RRRRRRR((s#/usr/lib/python2.7/unittest/case.pytassertNotAlmostEqual[s"  #    ,   csfd}|S(Ncs,tjdjjtd||S(NsPlease use {0} instead.i(RyRzR8RtPendingDeprecationWarning(RR(t original_func(s#/usr/lib/python2.7/unittest/case.pytdeprecated_funcs ((RR((Rs#/usr/lib/python2.7/unittest/case.pyt _deprecatesc Cs|dk rz|j}t||sF|jd|t|fnt||s|jd|t|fqnd}d}yt|}Wn!ttfk rd|}nX|dkryt|}Wqttfk rd|}qXn|dkr|||krdSt|} t|} t| dkrT| d d} nt| dkrw| d d} n|j| | f} d | }xt t ||D]} y|| } Wn/tt tfk r|d | |f7}PnXy|| }Wn/tt tfk r1|d | |f7}PnX| |kr|d | | |f7}PqqW||kr|dkrt |t |krdS||kr|d |||f7}y|d|||f7}Wqytt tfk r|d||f7}qyXq|||kr||d|||f7}y|d|||f7}Wqytt tfk ru|d||f7}qyXq|n|}ddj tjtj|jtj|j}|j||}|j||}|j|dS(sAAn 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. sFirst sequence is not a %s: %ssSecond sequence is not a %s: %stsequences(First %s has no length. Non-sequence?s)Second %s has no length. Non-sequence?Nis...s%ss differ: %s != %s s( Unable to index element %d of first %s s) Unable to index element %d of second %s s# First differing element %d: %s %s s+ First %s contains %d additional elements. sFirst extra element %d: %s s'Unable to index element %d of first %s s, Second %s contains %d additional elements. s(Unable to index element %d of second %s s (R5RRR1RtlenRtNotImplementedErrort capitalizetxrangetmint IndexErrorRtjointdifflibtndifftpprinttpformatt splitlinest_truncateMessageRR(Rtseq1tseq2Rtseq_typet seq_type_namet differingtlen1tlen2t seq1_reprt seq2_reprtelementstititem1titem2RtdiffMsg((s#/usr/lib/python2.7/unittest/case.pytassertSequenceEquals               cCsA|j}|dks't||kr/||S|tt|S(N(tmaxDiffR5Rt DIFF_OMITTED(Rtmessagetdifftmax_diff((s#/usr/lib/python2.7/unittest/case.pyRs cCs|j|||dtdS(sA 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(RRW(Rtlist1tlist2R((s#/usr/lib/python2.7/unittest/case.pyRIs cCs|j|||dtdS(sA 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(RRX(Rttuple1ttuple2R((s#/usr/lib/python2.7/unittest/case.pyRJs c Cspy|j|}WnGtk r9}|jd|n$tk r\}|jd|nXy|j|}WnGtk r}|jd|n$tk r}|jd|nX|p|sdSg}|r |jdx$|D]}|jt|qWn|rD|jdx$|D]}|jt|q$Wndj|} |j|j|| dS(sA 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). s/invalid type when attempting set difference: %ss2first argument does not support set difference: %ss3second argument does not support set difference: %sNs*Items in the first set but not the second:s*Items in the second set but not the first:s (t differenceRRR6RatreprRR( Rtset1tset2Rt difference1Rt difference2tlinestitemR((s#/usr/lib/python2.7/unittest/case.pyRKs2      cCsH||krDdt|t|f}|j|j||ndS(sDJust like self.assertTrue(a in b), but with a nicer default message.s%s not found in %sN(RRR(Rtmembert containerRR((s#/usr/lib/python2.7/unittest/case.pytassertInFs  cCsH||krDdt|t|f}|j|j||ndS(sHJust like self.assertTrue(a not in b), but with a nicer default message.s%s unexpectedly found in %sN(RRR(RRRRR((s#/usr/lib/python2.7/unittest/case.pyt assertNotInMs  cCsH||k rDdt|t|f}|j|j||ndS(sDJust like self.assertTrue(a is b), but with a nicer default message.s %s is not %sN(RRR(Rtexpr1texpr2RR((s#/usr/lib/python2.7/unittest/case.pytassertIsTs  cCs?||kr;dt|f}|j|j||ndS(sHJust like self.assertTrue(a is not b), but with a nicer default message.sunexpectedly identical: %sN(RRR(RRRRR((s#/usr/lib/python2.7/unittest/case.pyt assertIsNot[s cCs|j|td|j|td||krdt|tt|tf}ddjtjtj|j tj|j }|j ||}|j |j ||ndS(Ns"First argument is not a dictionarys#Second argument is not a dictionarys%s != %ss ( tassertIsInstanceRVRRRRRRRRRRR(Rtd1td2RRR((s#/usr/lib/python2.7/unittest/case.pyRHas "c Csg}g}xy|jD]k\}}||krA|j|q|||kr|jdt|t|t||fqqW|p|sdSd}|rddjd|D}n|r|r|d7}n|ddj|7}n|j|j||dS( s0Checks whether actual is a superset of expected.s%s, expected: %s, actual: %sNRs Missing: %st,css|]}t|VqdS(N(R(t.0tm((s#/usr/lib/python2.7/unittest/case.pys ~ss; sMismatched values: %s(t iteritemsRaRRRR( RR0tactualRtmissingt mismatchedtkeytvalueR((s#/usr/lib/python2.7/unittest/case.pytassertDictContainsSubsetms(    c Cs9t|t|}}tjtjr_x-dddgD]}tjd|tq?Wny"tj|}tj|}Wn t k rt ||} n X||krdSt ||} WdQX| r5d} g| D]} d| ^q} dj | } |j | | } |j|| }|j|ndS( sAn unordered sequence specific comparison. It asserts that actual_seq and expected_seq have the same element counts. Equivalent to:: self.assertEqual(Counter(iter(actual_seq)), Counter(iter(expected_seq))) Asserts that each element has the same count in both sequences. Example: - [0, 1, 1] and [1, 0, 1] compare equal. - [0, 0, 1] and [0, 1] compare unequal. s'(code|dict|type) inequality comparisonss,builtin_function_or_method order comparisonsscomparing unequal typestignoreNsElement counts were not equal: s First has %d, Second has %d: %rs (RWRytcatch_warningsR&t py3kwarningtfilterwarningstDeprecationWarningt collectionstCounterRRRRRRR(Rt expected_seqt actual_seqRt first_seqt second_seqt_msgRRt differencesRRRR((s#/usr/lib/python2.7/unittest/case.pytassertItemsEquals,      cCsG|j|td|j|td||krCt||jks\t||jkrr|j|||n|jt}|jt}t|dkr|jd|kr|dg}|dg}ndt|tt|tf}ddj t j ||}|j ||}|j |j||ndS( s-Assert that two multi-line strings are equal.sFirst argument is not a stringsSecond argument is not a stringis s s%s != %sRN(RR<Rt_diffThresholdRRRRlRRRRRRR(RRRRt firstlinest secondlinesRR((s#/usr/lib/python2.7/unittest/case.pyRLs$   ' cCsH||ksDdt|t|f}|j|j||ndS(sCJust like self.assertTrue(a < b), but with a nicer default message.s%s not less than %sN(RRR(RtatbRR((s#/usr/lib/python2.7/unittest/case.pyt assertLesss cCsH||ksDdt|t|f}|j|j||ndS(sDJust like self.assertTrue(a <= b), but with a nicer default message.s%s not less than or equal to %sN(RRR(RR R RR((s#/usr/lib/python2.7/unittest/case.pytassertLessEquals cCsH||ksDdt|t|f}|j|j||ndS(sCJust like self.assertTrue(a > b), but with a nicer default message.s%s not greater than %sN(RRR(RR R RR((s#/usr/lib/python2.7/unittest/case.pyt assertGreaters cCsH||ksDdt|t|f}|j|j||ndS(sDJust like self.assertTrue(a >= b), but with a nicer default message.s"%s not greater than or equal to %sN(RRR(RR R RR((s#/usr/lib/python2.7/unittest/case.pytassertGreaterEquals cCs?|dk r;dt|f}|j|j||ndS(sCSame as self.assertTrue(obj is None), with a nicer default message.s%s is not NoneN(R5RRR(RRRR((s#/usr/lib/python2.7/unittest/case.pyt assertIsNones cCs2|dkr.d}|j|j||ndS(s(Included for symmetry with assertIsNone.sunexpectedly NoneN(R5RR(RRRR((s#/usr/lib/python2.7/unittest/case.pytassertIsNotNones cCsEt||sAdt||f}|j|j||ndS(sTSame as self.assertTrue(isinstance(obj, cls)), with a nicer default message.s%s is not an instance of %rN(RRRR(RRReRR((s#/usr/lib/python2.7/unittest/case.pyRscCsEt||rAdt||f}|j|j||ndS(s,Included for symmetry with assertIsInstance.s%s is an instance of %rN(RRRR(RRReRR((s#/usr/lib/python2.7/unittest/case.pytassertNotIsInstancescOs@t|||}|dkr"|S||||WdQXdS(sAsserts that the message in a raised exception matches a regexp. Args: expected_exception: Exception class expected to be raised. expected_regexp: Regexp (re pattern object or string) expected to be found in error message. callable_obj: Function to be called. args: Extra args. kwargs: Extra kwargs. N(R/R5(Rtexpected_exceptionR2t callable_objRRR((s#/usr/lib/python2.7/unittest/case.pytassertRaisesRegexps  cCsht|tr!tj|}n|j|sd|p9d}d||j|f}|j|ndS(s=Fail the test unless the text matches the regular expression.sRegexp didn't matchs%s: %r not found in %rN(RR<R=R>R?R@R1(RttextR2R((s#/usr/lib/python2.7/unittest/case.pytassertRegexpMatches s  cCst|tr!tj|}n|j|}|r|p?d}d|||j|j!|j|f}|j|ndS(s9Fail the test if the text matches the regular expression.sRegexp matcheds%s: %r matches %r in %rN( RR<R=R>R?tstarttendR@R1(RRtunexpected_regexpRtmatch((s#/usr/lib/python2.7/unittest/case.pytassertNotRegexpMatchess  iiN(RRRR tAssertionErrorR1R:RRRt_classSetupFailedR RURbRcRdt classmethodRfRgRhRjRnRoRrRsRuRvRwR}R5RRRRRRRRRRRRRRRRt assertEqualstassertNotEqualstassertAlmostEqualstassertNotAlmostEqualstassert_RtfailUnlessEqualt failIfEqualtfailUnlessAlmostEqualtfailIfAlmostEqualt failUnlesstfailUnlessRaisestfailIfRRRIRJRKRRRRRHRRRLR R RRRRRRRRR(((s#/usr/lib/python2.7/unittest/case.pyRFs              Q            &$        g  +      (           tFunctionTestCasecBszeZdZd d d dZdZdZdZdZdZ dZ dZ d Z d Z d ZRS( sIA 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. cCs;tt|j||_||_||_||_dS(N(R R,R t _setUpFunct _tearDownFunct _testFunct _description(RttestFuncRcRdt description((s#/usr/lib/python2.7/unittest/case.pyR )s    cCs |jdk r|jndS(N(R-R5(R((s#/usr/lib/python2.7/unittest/case.pyRc0scCs |jdk r|jndS(N(R.R5(R((s#/usr/lib/python2.7/unittest/case.pyRd4scCs|jdS(N(R/(R((s#/usr/lib/python2.7/unittest/case.pyRG8scCs |jjS(N(R/R(R((s#/usr/lib/python2.7/unittest/case.pyRo;scCs\t||jstS|j|jko[|j|jko[|j|jko[|j|jkS(N(RRQRpR-R.R/R0(RRq((s#/usr/lib/python2.7/unittest/case.pyRr>s cCs ||k S(N((RRq((s#/usr/lib/python2.7/unittest/case.pyRsGscCs+tt||j|j|j|jfS(N(RtRR-R.R/R0(R((s#/usr/lib/python2.7/unittest/case.pyRuJscCsdt|j|jjfS(Ns%s (%s)(RRQR/R(R((s#/usr/lib/python2.7/unittest/case.pyRvNscCsdt|j|jfS(Ns <%s tec=%s>(RRQR/(R((s#/usr/lib/python2.7/unittest/case.pyRwRscCsE|jdk r|jS|jj}|rA|jddjpDdS(Ns i(R0R5R/R RkRl(RRm((s#/usr/lib/python2.7/unittest/case.pyRnVs N(RRR R5R RcRdRGRoRrRsRuRvRwRn(((s#/usr/lib/python2.7/unittest/case.pyR, s        ($R RR+R&RRRR=RRyRRtutilRRRRRRt __unittestRR%RR RRR!R#R$R)R-R.tobjectR/RFR,(((s#/usr/lib/python2.7/unittest/case.pyts:         (       #x