mò %U²Ic@sYdZedjo ed‚ndkZdefd„ƒYZdefd„ƒYZdefd „ƒYZd efd „ƒYZd Z dZ da d „Z d„Zd„Zd„Zd„Zdd„Zddd„ZdZd„Zyed ZWnej o dZnXeiidƒZdkZeidjo dZnÏeidjo dZnµdZeo§edeƒo dZ neddƒZ ei!ƒZ"e#ed ƒ pei$ƒd!d"jo dZ%qe&d#ƒZ%ye%i'd$ƒWne(j oqXd%e%GHndZ)ye*ed&ƒZ)Wnie+j o]ei,i-d'eƒZ.ye*e.d&ƒZ)e.Z[.Wqœe+j od(ee.fGHqœXnXe)dj o)e)i/ƒyei0eƒWqÒqÒXn[[)d)kl0Z0e1d*„Z2d+d,„Z3d-„Z4d.„Z5d/„Z6dk7Z7d0fd1„ƒYZ8dd2„Z9d3„Z:dd4„Z;dS(5s7Supporting definitions for the Python regression tests.stest.test_supports3test_support must be imported from the test packageNtErrorcBstZdZRS(s*Base class for regression test exceptions.(t__name__t __module__t__doc__(((t./data/zmath/lib/python2.4/test/test_support.pyRs t TestFailedcBstZdZRS(s Test failed.(RRR(((RR s t TestSkippedcBstZdZRS(s!Test skipped. This can be raised to indicate that a test was deliberatly skipped, but not because a feature wasn't available. For example, if some resource can't be used, such as the network appears to be unavailable, this should be raised instead of TestFailed. (RRR(((RRs tResourceDeniedcBstZdZRS(sàTest skipped because it requested a disallowed resource. This is raised when a test calls requires() for a resource that has not be enabled. It is used to distinguish between expected and unexpected skips. (RRR(((RRs icCs |adS(N(tstdoutt_original_stdout(R((Rtrecord_original_stdout'scCstptiS(N(R tsysR(((Rtget_original_stdout+scCs(yti|=Wntj onXdS(N(R tmodulestnametKeyError(R((Rtunload.scCs³t|ƒdk}x™tiD]Ž}y+|i|ii|||idƒƒWn|i j onXy+|i|ii|||idƒƒWq|i j oqXqWdS(sm"Forget" a module was ever imported by removing it from sys.modules and deleting any .pyc and .pyo files.Ntpyctpyo( RtmodnametosR tpathtdirnametunlinktjointextsepterror(RRR((Rtforget4s   ++cCstdj o |tjS(sPTest whether a resource is enabled. Known resources are set by regrtest.py.N(t use_resourcestNonetresource(R((Rtis_resource_enabledFscCsftiƒiiidƒdjodSnt|ƒp+|djod|}nt |ƒ‚ndS(sÛRaise ResourceDenied if the specified resource is not available. If the caller's module is __main__ then automatically return True. The possibility of False being returned occurs when regrtest.py is executing.Rt__main__Ns$Use of the `%s' resource not enabled( R t _getframetf_backt f_globalstgetRRtmsgRR(RR%((RtrequiresKs"  ti1ÔcCs dk}dk}x~|dddgD]j}y|i||fƒ|SWq%|ij o7\}}||i jo‚nt i d|IJq%Xq%Wt d‚dS(s Try to bind the sock to a port. If we are running multiple tests and we don't try multiple ports, the test can fails. This makes the test more robust.Ni³&i(iç€s6 WARNING: failed to listen on port %d, trying anothers unable to find port to listen on(tsocketterrnotpreferred_porttporttsocktbindthostRterrR%t EADDRINUSER t __stderr__R(R,R.R*R(R/R)R%R+((Rt bind_portYsf9.9999999999999995e-07cCsRt|ƒtdƒjpt|ƒtdƒjo`yRt||ƒ\}}t|ƒt|ƒt}t||ƒ|jodSnWqEqEXn´t|ƒt|ƒjošt|ƒtfƒtgƒfjouxUttt |ƒt |ƒƒƒD]2}t ||||ƒ}|djo|SqòqòWt t |ƒt |ƒƒSnt ||ƒS(Nf0.0i(ttypetxtytcoercetabstFUZZtfuzztrangetmintlentitfcmptoutcometcmp(R4R5R=R9R?((RR>ms 2 >"  itjavas$testtriscosttestfiles@tests@test-àòslatin-1tgetwindowsversioniis'u"@test-\u5171\u6709\u3055\u308c\u308b"tLatin1sgWARNING: The filename %r CAN be encoded by the filesystem. Unicode filename tests may not be effectivesw+s/tmps6WARNING: tests will fail, unable to write to: %s or %s(sunlinkcCs‹dk}|ii|ƒo|Snti}|ii|ƒg|}x>|D]6}|ii||ƒ}|ii |ƒo|SqMqMW|S(sÕTry to find a file on sys.path and the working directory. If it is not found the argument passed to the function is returned (this does not necessarily signal failure; could still be the legitimate path).N( RRtisabstfileR RtheretdnRtfntexists(RGRHRIRRRJ((RtfindfileÌs   s test failedcCs|pt|ƒ‚ndS(s–Verify that condition is true. If not, raise TestFailed. The optional argument reason can be given to provide a better error text. N(t conditionRtreason(RMRN((RtverifyÚscCs(||jptd||f‚ndS(s$Raise TestFailed if a == b is false. This is better than verify(a == b) because, in case of failure, the error message incorporates repr(a) and repr(b) so you can see the inputs. Note that "not (a == b)" isn't necessarily the same as "a != b"; the former is tested. s%r == %rN(tatbR(RPRQ((Rtvereqäs  cCsR|iƒ}|iƒg}|D]}|d|q!~}di|ƒ}d|S(s%Like repr(dict), but in sorted order.s%r: %rs, s{%s}N(tdicttitemstsortt_[1]tpairt reprpairsRt withcommas(RSRXRYRTRVRW((Rtsortdictòs   %cCs7yt|ddƒWntj on Xd|GHdS(NstexecsMissing SyntaxError: "%s"(tcompilet statementt SyntaxError(R]((Rt check_syntaxús tBasicTestRunnercBstZd„ZRS(NcCstiƒ}||ƒ|S(N(tunittestt TestResulttresultttest(tselfRdRc((Rtrun s  (RRRf(((RR` scCstotitiddƒ}n tƒ}|i|ƒ}|i ƒpµt |i ƒdjo |i o|i dd}npt |i ƒdjo |i o|i dd}n:|djo d}nd|i|if}t|ƒ‚t|ƒ‚ndS(s2Run tests from a unittest.TestSuite-derived class.t verbosityiiis0errors occurred; run in verbose mode for detailsserrors occurred in %s.%sN(tverboseRatTextTestRunnerR RtrunnerR`RftsuiteRct wasSuccessfulR<terrorstfailuresR/t testclassRR%RRR(RkRoR/RjRcR%((Rt run_suites  !!   cGs˜tiƒ}xQ|D]I}t|titifƒo|i|ƒq|iti|ƒƒqWt |ƒdjo|d}nd}t ||ƒdS(s1Run tests from unittest.TestCase-derived classes.iiN( Rat TestSuiteRktclassestclst isinstancetTestCasetaddTestt makeSuiteR<RoRRp(RrRoRkRs((Rt run_unittest(s cCs¯dk}|djo t}nd}ti}tƒt_z@|i|d|ƒ\}}|ot d||fƒ‚nWd|t_Xtod|i |fGHn||fS(s Run doctest on the given module. Return (#failures, #tests). If optional argument verbosity is not specified (or is None), pass test_support's belief about verbosity on to doctest. Else doctest's usual behavior is used (it searches sys.argv for -v). NRhs%d of %d doctests faileds,doctest (%s) ... %d tests with zero failures(tdoctestRgRRhR Rt save_stdoutR ttestmodtmoduletfttRR(R|RgRzR}R~Ry((Rt run_doctest:s       (<RRt ImportErrorR t ExceptionRRRRRhRRR R R RRRR&R2R8R>tunicodet have_unicodet NameErrortplatformt startswitht is_jythonRRtTESTFNRttTESTFN_UNICODEtgetfilesystemencodingtTESTFN_ENCODINGthasattrRDtTESTFN_UNICODE_UNENCODEABLEtevaltencodetUnicodeEncodeErrortfptopentIOErrorRRt TMP_TESTFNtcloseRt__file__RLRORRRZR_RaR`RpRxR($RRRhR`RaRRRR_R‰RRƒROR‡R‹R8RxRRLR R‘RR2RZR RRRˆR RRRRR>RpR”R&((Rt?s’                  (