B z'<)z'r?r@r. result_varr r r!rBs  zNumpyDocTestCase.__init__)rNNNNr=)rrr3rBr r r r!r<sr<c@sjeZdZdZdZejejBZddgZ e Z e Z eZejfddZddZd d Zd d Zd dZddZdS) NumpyDoctestZ numpydoctestizgenerate_numpy_api.pyzsetup.pycCst|||d|_d|_dS)NT)roptionsZ doctest_testsdoctest_result_var)rparserenvr r r!rFszNumpyDoctest.optionscCsBt|||||_t|_|jr>dd|jjD|j_dS)NcSsg|]}|jdkr|qS)r%)r/).0pr r r! sz*NumpyDoctest.configure..) r configuretest_finder_classfinderr%Z DocTestParserrHenabledplugins)rrFconfigr r r!rMs   zNumpyDoctest.configurecCsXttj|j}tddtd|_d|krT|d}|d}t ||ji|g|j|<dS)a` Configure `test` object to set test context We set the numpy / scipy standard doctest namespace Parameters ---------- test : test object with ``globs`` dictionary defining namespace Returns ------- None Notes ----- `test` object modified in place __main__) __builtins____file__rZnpZscipy.N) r ospathdirnamefilenamerTnumpyr0split __import__)rrCZpkg_namerKZp2r r r!set_test_contexts   zNumpyDoctest.set_test_contextccs||jstjd|dSy|j|}Wntk rBdSX|sLdS|t |j }xF|D]>}|j spqd|j s|||_ | ||j||j||jdVqdWdS)NzDoctest doesn't want module %s)r;r@rD)ZmatchesrnpdlogdebugrOfindAttributeErrorsortr rUZexamplesr[r_doctest_case_classdoctest_optflagsout_check_classrG)rrr-Z module_filerCr r r!loadTestsFromModules*    z NumpyDoctest.loadTestsFromModulecCstjftdS)N)r\Zset_printoptions print_state)rr r r! afterContextszNumpyDoctest.afterContextcCs(tj|}||jkrdStj||S)NF)rXrYbasenamedoctest_ignorer`DoctestwantFile)rfileZbnr r r!ros  zNumpyDoctest.wantFileN)rrr3r/scorer%ZNORMALIZE_WHITESPACEELLIPSISrgrmr<rfr4rhrrNrXenvironrFrMr_rirkror r r r!rEs   *rEc@s6eZdZdZdZdZdZd ddZdd Zd d Z d S) Unpluggerzi Nose plugin to remove named plugin late in loading By default it removes the "doctest" plugin. Z unpluggerTir%cCs ||_dS)N) to_unplug)rrur r r!rBszUnplugger.__init__cCsdS)Nr )rrHrIr r r!rFszUnplugger.optionscsfdd|jjD|j_dS)Ncsg|]}|jjkr|qSr )r/ru)rJrK)rr r!rLsz'Unplugger.configure..)rQ)rrFrRr )rr!rMszUnplugger.configureN)r%) rrr3__doc__r/rPrqrBrFrMr r r r!rts rtc@s8eZdZdZdZeedddZej fddZ dd Z d S) KnownFailurePlugina1Plugin that installs a KNOWNFAIL error class for the KnownFailureClass exception. When KnownFailure is raised, the exception will be logged in the knownfail attribute of the result, 'K' or 'KNOWNFAIL' (verbose) will be output, and the exception will not be counted as an error or failure.TZ KNOWNFAILF)ZlabelZ isfailurecCs$d}|jddd||ddddS)NZNOSE_WITHOUT_KNOWNFAILz--no-knownfail store_true noKnownFailFz3Disable special handling of KnownFailure exceptions)actiondestdefaulthelp)Z add_optionget)rrHrIZenv_optr r r!rF.s zKnownFailurePlugin.optionscCs*|js dS||_t|dd}|r&d|_dS)NryF)Z can_configureconfr*rP)rrFrZdisabler r r!rM5s  zKnownFailurePlugin.configureN) rrr3rvrPrr Z knownfailrXrsrFrMr r r r!rw#srwc@seZdZddZdS)NumpyTestProgramcCsh|jdkr(tjj|jj|jj|jd|_|jj|j}|dk rF||_|j |j |_ |j |_ |j S)aRun Tests. Returns true on success, false on failure, and sets self.success to the same value. Because nose currently discards the test result object, but we need to return it to the user, override TestProgram.runTests to retain the result N)stream verbosityrR)Z testRunnernosecoreZTextTestRunnerrRrrrQZprepareTestRunnerrunrCresultZ wasSuccessfulsuccess)rZ plug_runnerr r r!runTestsCs    zNumpyTestProgram.runTestsN)rrr3rr r r r!rBsr))Z __future__rrrrXr%rrZ nose.pluginsrr`Znose.plugins.errorclassrrZnose.plugins.baserZ nose.utilr r\Z nosetesterr Zutilsr r r&rr8r4rAr<Zget_printoptionsrjrnrErrtrwZ KnownFailurerZ TestProgramrr r r r!s(     O x