K9Qc!@sGdZdZdddddddd d d d d ddddddddddddddddddd d!d"g!Zd#d$lZd#d$lZd#d$lZd#d$lZd#d$lZd#d$lZd#d$l Z d#d$l Z d#d$l Z d#d$l Z d#d$l Z d#d$lZd#d%lmZejd&deed'iZd(ZedZedZedZedZedZeeBeBeBeBZed Zed Zed Zed ZeeBeBeBZd)Z d*Z!d+Z"d,Z#d-d.Z$d/d0Z%d1Z&d2efd3YZ'd4Z(d5Z)d6e j*fd7YZ+d8Z,dfd9YZ-dfd:YZ.dfd;YZ/dfd<YZ0dfd=YZ1dfd>YZ2de3fd?YZ4de3fd@YZ5de1fdAYZ6e7a8e7e7e7e7e7e9d'e7e:e:dB Z;e9e7e7e7e7e9d'e7e:e/dC Z<e:dDe7d'dEZ=dfdFYZ>d'a?dGZ@dHe jAfdIYZBe7e7e7e7dJZCdKeBfdLYZDe9e7e7e/dMZEdNZFdOZGdPZHe:e7dQZIe:e7dRZJe:dSZKiZLd$S(TsModule doctest -- a framework for running examples in docstrings. In simplest use, end each module M to be tested with: def _test(): import doctest doctest.testmod() if __name__ == "__main__": _test() Then running the module as a script will cause the examples in the docstrings to get executed and verified: python M.py This won't display anything unless an example fails, in which case the failing example(s) and the cause(s) of the failure(s) are printed to stdout (why not stderr? because stderr is a lame hack <0.2 wink>), and the final line of output is "Test failed.". Run it with the -v switch instead: python M.py -v and a detailed report of all examples tried is printed to stdout, along with assorted summaries at the end. You can force verbose mode by passing "verbose=True" to testmod, or prohibit it by passing "verbose=False". In either of those cases, sys.argv is not examined by testmod. There are a variety of other ways to run doctests, including integration with the unittest framework, and support for running non-Python text files containing doctests. There are also many ways to override parts of doctest's default behaviors. See the Library Reference Manual for details. sreStructuredText entregister_optionflagtDONT_ACCEPT_TRUE_FOR_1tDONT_ACCEPT_BLANKLINEtNORMALIZE_WHITESPACEtELLIPSIStIGNORE_EXCEPTION_DETAILtCOMPARISON_FLAGSt REPORT_UDIFFt REPORT_CDIFFt REPORT_NDIFFtREPORT_ONLY_FIRST_FAILUREtREPORTING_FLAGSt is_privatetExampletDocTestt DocTestParsert DocTestFindert DocTestRunnert OutputCheckertDocTestFailuretUnexpectedExceptiont DebugRunnerttestmodttestfiletrun_docstring_examplestTestert DocTestSuitet DocFileSuitetset_unittest_reportflagstscript_from_examplest testsourcet debug_srctdebugiN(tStringIOtignoreicCstj|dtt>S(Ni(tOPTIONFLAGS_BY_NAMEt setdefaulttlen(tname((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pyRss s...cCsItjdtdd|d dkoH|d dkoE|dkn S(s}prefix, base -> true iff name prefix + "." + base is "private". Prefix may be an empty string, and base does not contain a period. Prefix is ignored (although functions you write conforming to this protocol may make use of it). Return true iff base begins with an (at least one) underscore, but does not both begin and end with (at least) two underscores. sVis_private is deprecated; it wasn't useful; examine DocTestFinder.find() lists insteadt stackleveliit_t__i(twarningstwarntDeprecationWarning(tprefixtbase((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pyR s  cCsUd}xHtjD]=}|j|d}|tt|kr||jO}qqW|S(s Return the compiler-flags associated with the future features that have been imported into the given namespace (globs). iN(t __future__tall_feature_namestgettNonetgetattrt compiler_flag(tglobstflagstfnametfeature((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pyt_extract_future_flagss icCs{tj|r|St|ttfrDt|ttdgS|dkrkt j t j |j dSt ddS(s Return the module specified by `module`. In particular: - If `module` is a module, then return module. - If `module` is a string, then import and return the module with that name. - If `module` is None, then return the calling module. The calling module is assumed to be the module of the stack frame at the given depth in the call stack. t*t__name__s"Expected a module, string, or NoneN(tinspecttismodulet isinstancetstrtunicodet __import__tglobalstlocalsR2tsystmodulest _getframet f_globalst TypeError(tmoduletdepth((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pyt_normalize_modules  icCstjd|d|S(s{ Add the given number of space characters to the beginning every non-blank line in `s`, and return the result. s (?m)^(?!$)t (tretsub(tstindent((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pyt_indentscCs;t}|\}}}tj|||d||jS(sz Return a string containing a traceback message for the given exc_info tuple (as returned by sys.exc_info()). tfile(R!t tracebacktprint_exceptiontgetvalue(texc_infotexcouttexc_typetexc_valtexc_tb((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pyt_exception_tracebacks t _SpoofOutcBseZdZddZRS(cCsNtj|}|r2|jd r2|d7}nt|drJ|`n|S(Ns t softspace(R!RUtendswiththasattrR](tselftresult((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pyRUs   cCs,tj||t|dr(|`ndS(NR](R!ttruncateR_R](R`tsize((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pyRbsN(R;t __module__RUR2Rb(((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pyR\s cCs&t|kr||kS|jt}t|dks=tdt|}}|d}|r|j|rt|}|d=qtSn|d}|r|j|r|t|8}|d=qtSn||krtSxC|D];}|j|||}|dkrtS|t|7}qWtS(Niii( tELLIPSIS_MARKERtsplitR%tAssertionErrort startswithtFalseR^tfindtTrue(twanttgottwststartpostendpostw((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pyt_ellipsis_match s2          cCs"|j}|rd|SdSdS(s)Return a commented form of the given lines# t#N(trstrip(tline((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pyt _comment_line9s t_OutputRedirectingPdbcBs eZdZdZdZRS(s A specialized version of the python debugger that redirects stdout to a given stream when interacting with the user. Stdout is *not* redirected when traced code is executed. cCs||_tjj|dS(N(t_OutputRedirectingPdb__outtpdbtPdbt__init__(R`tout((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pyR{Gs cGs=tj}|jt_ztjj||SWd|t_XdS(N(RDtstdoutRxRyRzttrace_dispatch(R`targst save_stdout((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pyR~Ks   (R;Rdt__doc__R{R~(((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pyRwAs cCstj|std|n|jdr:tdnt|dretjj|j d}nw|j dkrt t j dkrt j ddkrtjjt j dd}qtj}ntd|d tjj||jdS( NsExpected a module: %rt/s1Module-relative files may not have absolute pathst__file__it__main__ts+Can't resolve paths relative to the module s (it has no __file__)(R<R=RHRht ValueErrorR_tostpathRfRR;R%RDtargvtcurdirtjoin(RIRtbasedir((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pyt_module_relative_pathVs (  cBs#eZdZdddddZRS(sn A single doctest example, consisting of source code and expected output. `Example` defines the following attributes: - source: A single Python statement, always ending with a newline. The constructor adds a newline if needed. - want: The expected output from running the source code (either from stdout, or a traceback in case of exception). `want` ends with a newline unless it's empty, in which case it's an empty string. The constructor adds a newline if needed. - exc_msg: The exception message generated by the example, if the example is expected to generate an exception; or `None` if it is not expected to generate an exception. This exception message is compared against the return value of `traceback.format_exception_only()`. `exc_msg` ends with a newline unless it's `None`. The constructor adds a newline if needed. - lineno: The line number within the DocTest string containing this Example where the Example begins. This line number is zero-based, with respect to the beginning of the DocTest. - indent: The example's indentation in the DocTest string. I.e., the number of space characters that preceed the example's first prompt. - options: A dictionary mapping from option flags to True or False, which is used to override default options for this example. Any option flags not contained in this dictionary are left at their default value (as specified by the DocTestRunner's optionflags). By default, no options are set. icCs|jds|d7}n|r?|jd r?|d7}n|dk rh|jd rh|d7}n||_||_||_||_|dkri}n||_||_dS(Ns (R^R2tsourceRltlinenoRPtoptionstexc_msg(R`RRlRRRPR((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pyR{s         N(R;RdRR2R{(((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pyR zs" cBs)eZdZdZdZdZRS(se A collection of doctest examples that should be run in a single namespace. Each `DocTest` defines the following attributes: - examples: the list of examples. - globs: The namespace (aka globals) that the examples should be run in. - name: A name identifying the DocTest (typically, the name of the object whose docstring this DocTest was extracted from). - filename: The name of the file that this DocTest was extracted from, or `None` if the filename is unknown. - lineno: The line number within filename where this DocTest begins, or `None` if the line number is unavailable. This line number is zero-based, with respect to the beginning of the file. - docstring: The string that the examples were extracted from, or `None` if the string is unavailable. cCs\t|t std||_||_|j|_||_||_||_ dS(s Create a new DocTest containing the given examples. The DocTest's globals are initialized with a copy of `globs`. s8DocTest no longer accepts str; use DocTestParser insteadN( R>t basestringRgtexamplest docstringtcopyR5R&tfilenameR(R`RR5R&RRR((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pyR{s     cCslt|jdkrd}n1t|jdkr<d}ndt|j}d|j|j|j|fS(Nis no examplesis 1 examples %d exampless(R%RR&RR(R`R((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pyt__repr__s  cCsVt|tsdSt|j|j|jt|f|j|j|jt|fS(Ni(R>RtcmpR&RRtid(R`tother((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pyt__cmp__s!(R;RdRR{RR(((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pyRs  cBseZdZejdejejBZejdejejBejBZ ejdj Z ddZ dZ ddZdZejd ejZd Zejd ejZd Zd ZdZRS(sD A class used to parse strings containing doctest examples. s # Source consists of a PS1 line followed by zero or more PS2 lines. (?P (?:^(?P [ ]*) >>> .*) # PS1 line (?:\n [ ]* \.\.\. .*)*) # PS2 lines \n? # Want consists of any non-blank lines that do not start with PS1. (?P (?:(?![ ]*$) # Not a blank line (?![ ]*>>>) # Not a line starting with PS1 .*$\n? # But any other line )*) s # Grab the traceback header. Different versions of Python have # said different things on the first traceback line. ^(?P Traceback\ \( (?: most\ recent\ call\ last | innermost\ last ) \) : ) \s* $ # toss trailing whitespace on the header. (?P .*?) # don't blink: absorb stuff until... ^ (?P \w+ .*) # a line *starts* with alphanum. s ^[ ]*(#.*)?$sc Csx|j}|j|}|dkrYdjg|jdD]}||^q=}ng}d\}}x|jj|D]}|j|||j!||jd||j7}|j |||\} } } } |j | s.|jt | | | d|d|t |j dd| n||jd|j|j7}|j}q~W|j|||S(s= Divide the given string into examples and intervening text, and return them as a list of alternating Examples and strings. Line numbers for the Examples are 0-based. The optional argument `name` is a name identifying this string, and is only used for error messages. is RRPR(ii(t expandtabst _min_indentRRft _EXAMPLE_REtfinditertappendtstarttcountt_parse_examplet_IS_BLANK_OR_COMMENTR R%tgrouptend( R`tstringR&t min_indenttltoutputtcharnoRtmRRRlR((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pytparses&  2 ! %cCs%t|j|||||||S(s" Extract all doctest examples from the given string, and collect them into a `DocTest` object. `globs`, `name`, `filename`, and `lineno` are attributes for the new `DocTest` object. See the documentation for `DocTest` for more information. (Rt get_examples(R`RR5R&RR((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pyt get_doctestBs cCs2g|j||D]}t|tr|^qS(s Extract all doctest examples from the given string, and return them as a list of `Example` objects. Line numbers are 0-based, because it's most common in doctests that nothing interesting appears on the same line as opening triple-quote, and so the first interesting line is called "line 1" then. The optional argument `name` is a name identifying this string, and is only used for error messages. (RR>R (R`RR&tx((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pyRNs c Cs~t|jd}|jdjd}|j|||||j|dd|d||djg|D]}||d^qr}|jd}|jd} t| dkrtjd | d r| d =n|j| d|||t|djg| D]} | |^q}|jj|}|rS|jd } nd } |j |||} || || fS( s Given a regular expression match from `_EXAMPLE_RE` (`m`), return a pair `(source, want)`, where `source` is the matched example's source code (with prompts and indentation stripped); and `want` is the example's expected output (with indentation stripped). `name` is the string's name, and `lineno` is the line number where the example starts; both are used for error messages. RPRs iRLt.iRls *$itmsgN( R%RRft_check_prompt_blankt _check_prefixRRMtmatcht _EXCEPTION_RER2t _find_options( R`RR&RRPt source_linestslRRlt want_linestwlRR((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pyR\s$ "*( &s#\s*doctest:\s*([^\n\'"]*)$c Csi}x|jj|D]}|jdjddj}xp|D]h}|ddksm|dtkrtd|d||fnt|d}|ddk||tpropertyR(R`RItobject((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pyt _from_moduleSs c Cs?|jrd|GHnt||kr+dSd|t|<|j|||||}|dk rr|j|ntj|r*|jr*x|jj D]\} } |j | || rqnd|| f} tj | stj | r|j || r|j|| | ||||qqWntj|r/|jr/xt|dij D]\} } t| tstdt| fntj | ptj | ptj| ptj| pt| tstdt| fnd|| f} |j|| | ||||q[Wntj |r;|jr;x|jj D]\} } |j | || r~qWnt| trt|| } nt| trt|| j} ntj | stj | st| trW|j || rWd|| f} |j|| | ||||qWqWWndS( sm Find tests for the given object and any contained objects, and add them to `tests`. sFinding tests in %sNis%s.%st__test__s5DocTestFinder.find: __test__ keys must be strings: %rs`DocTestFinder.find: __test__ values must be strings, functions, methods, classes, or modules: %rs%s.__test__.%s(RRt _get_testR2RR<R=RRtitemsRRRRRR3R>RRRtismethodt staticmethodt classmethodtim_funcR( R`RRR&RIRR5tseenttesttvalnametval((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pyRhsX   %c Cs6t|tr|}ncyC|jd kr3d}n'|j}t|tsZt|}nWnttfk rzd}nX|j||}|jr| rd S|d krd }ndt |d|j }|dd kr|d }n2t j j dr|jdrd |d }n|jj|||||S( ss Return a DocTest for the given object, if it defines a docstring; otherwise, return None. RRis.pycs.pyoitjavas $py.classs%s.pyiN(s.pycs.pyo(R>RRR2R?RHtAttributeErrort _find_linenoRR3R;RDtplatformRhR^RR( R`RR&RIR5RRRR((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pyRs.       cCsd}tj|rd}ntj|r|dkr=dStjdt|dd}x6t|D]%\}}|j|ri|}PqiqiWntj |r|j }ntj |r|j }ntj |r|j}ntj|r|j}ntj|r)t|ddd}n|dk r|dkrI|dStjd}x7t|t|D]}|j||rn|SqnWndS( s Return a line number of the given object's docstring. Note: this method assumes that the object has a docstring. is^\s*class\s*%s\bR;t-tco_firstlinenois(^|.*:)\s*\w*("|')N(R2R<R=RRMRR3RRRRRt func_codet istracebackttb_frametisframetf_codetiscodetrangeR%(R`RRRtpatRRu((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pyRs<           N(R;RdRRiRRkR2R{RjRRRRR(((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pyRs   S   E (cBseZddZddddZdZdZdZdZdZ d Z d Z e j d Zd Zdded ZddZdZRS(R:iFicCsv|p t|_|dkr0dtjk}n||_||_||_d|_d|_ i|_ t |_ dS(sc Create a new test runner. Optional keyword arg `checker` is the `OutputChecker` that should be used to compare the expected outputs and actual outputs of doctest examples. Optional keyword arg 'verbose' prints lots of stuff if true, only failures if false; by default, it's true iff '-v' is in sys.argv. Optional argument `optionflags` can be used to control how the test runner compares expected output to actual output, and how it displays failures. See the documentation for `testmod` for more information. s-viN( Rt_checkerR2RDRRt optionflagstoriginal_optionflagsttriestfailurest_name2ftR\t_fakeout(R`tcheckerRR((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pyR{s       cCs_|jr[|jr=|dt|jdt|jq[|dt|jdndS(s Report that the test runner is about to process the given example. (Only displays a message if verbose=True) sTrying: s Expecting: sExpecting nothing N(RRlRQR(R`R|Rtexample((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pyt report_start2s   (cCs|jr|dndS(st Report that the given example ran successfully. (Only displays a message if verbose=True) sok N(R(R`R|RR Rm((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pytreport_success?s cCs3||j|||jj|||jdS(s7 Report that the given example failed. N(t_failure_headerRtoutput_differenceR(R`R|RR Rm((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pytreport_failureGscCs.||j||dtt|dS(sO Report that the given example raised an unexpected exception. sException raised: N(RRQR[(R`R|RR RV((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pytreport_unexpected_exceptionNscCs|jg}|jrs|jdk rJ|jdk rJ|j|jd}nd}|jd|j||jfn!|jd|jd|jf|jd|j}|jt|dj|S(Nit?sFile "%s", line %s, in %ssLine %s, in %ssFailed example:s ( tDIVIDERRRR2RR&RRQR(R`RR R|RR((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pyRUs   !  c Bsd}}|j}ed\}}} |jj} x,e|jD]\} } |je@of|dk} ||_| jrxH| jjD]4\}}|r|j|O_q|j|M_qWn|d7}| s|j ||| nd|j | f}y7e | j |d|d|j U|jjd }Wn3ek rLn ej}|jjnX|jj}|jjd|}|d kr| | j||jr|}qnej}ej|d d}| s|e|7}n| jd kr| }n| | j||jr6|}ns|je@rejd| j}ejd|}|r|r| |jd|jd|jr|}qn||kr| s_|j ||| |q_qD||kr| s|j!||| |n|d7}qD|| krG| s:|j"||| |n|d7}qDe#sDt$d |fqDW||_|j%|||||fS( s Run the examples in `test`. Write the outcome of each example with one of the `DocTestRunner.report_*` methods, using the writer function `out`. `compileflags` is the set of compiler flags that should be used to execute examples. Return a tuple `(f, t)`, where `t` is the number of examples tried, and `f` is the number of examples that failed. The examples are run in the namespace `test.globs`. iiistsingleiis[^:]*:sunknown outcomeN(&RRRt check_outputRRR RRR R&RRR5tdebuggert set_continueR2tKeyboardInterruptRDRVR RURbRlRStformat_exception_onlyR[RRRMRRRRRRiRgt_DocTestRunner__record_outcome(R`Rt compileflagsR|RRRtSUCCESStFAILUREtBOOMtcheckt examplenumR tquiett optionflagRRt exceptionRmtoutcomeRVRtm1tm2((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pyt__runis~                  '         cCs^|jj|jd\}}||||f|j|j<|j|7_|j|7_dS(s{ Record the fact that the given DocTest (`test`) generated `f` failures out of `t` tried examples. iN(ii(R R1R&RR(R`Rtftttf2tt2((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pyt__record_outcomess3[\w\.]+)\[(?P\d+)\]>$cCss|jj|}|rb|jd|jjkrb|jjt|jd}|jjt S|j |SdS(NR&R!( t%_DocTestRunner__LINECACHE_FILENAME_RERRRR&RtintRt splitlinesRktsave_linecache_getlines(R`RRR ((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pyt__patched_linecache_getliness !cCs||_|dkr't|j}ntj}|dkrH|j}n|jt_tj }t ||_ |j j |j j t_ t j|_|jt _z|j|||SWd|t_|t_ |jt _|r|jjnXdS(sJ Run the examples in `test`, and display the results using the writer function `out`. The examples are run in the namespace `test.globs`. If `clear_globs` is true (the default), then this namespace will be cleared after the test runs, to help with garbage collection. If you would like to examine the namespace after the test completes, then use `clear_globs=False`. `compileflags` gives the set of flags that should be used by the Python compiler when running the examples. If not specified, then it will default to the set of future-import flags that apply to `globs`. The output of each example is checked using `DocTestRunner.check_output`, and the results are formatted by the `DocTestRunner.report_*` methods. N(RR2R9R5RDR}twriteR Ryt set_traceRwRtresetRRR1t*_DocTestRunner__patched_linecache_getlinest_DocTestRunner__runtclear(R`RRR|t clear_globsRtsave_set_trace((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pytruns(             c Cs|dkr|j}ng}g}g}d}}x|jjD]}|\}\} } | | ksnt|| 7}|| 7}| dkr|j|qD| dkr|j|| fqD|j|qDW|r^|rt|GdGH|jx|D]} dG| GHqWn|r^t|GdGH|jx&|D]\} } d| | fGHq9Wq^n|r|jGHt|GdGH|jx/|D]$\} \} } d| | | fGHqWn|r|GdGt|jGd GH||Gd G|Gd GHn|rd G|Gd GHn|rdGHn||fS(s Print a summary of all the test cases that have been run by this DocTestRunner, and return a tuple `(f, t)`, where `f` is the total number of failed examples, and `t` is the total number of tried examples. The optional `verbose` argument controls how detailed the summary is. If the verbosity is not specified, then the DocTestRunner's verbosity is used. isitems had no tests:s sitems passed all tests:s %3d tests in %ssitems had failures:s %3d of %3d in %sstests insitems.s passed andsfailed.s***Test Failed***s failures.s Test passed.N( R2RR RRgRR%RR( R`RtnoteststpassedtfailedttotaltttotalfRR&R)R*tthingR((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pyt summarize/sR           cCs|j}xs|jjD]b\}\}}||krkd|dGH||\}}||}||}n||f||A unittest suite for one or more doctest files. The path to each doctest file is given as a string; the interpretation of that string depends on the keyword argument "module_relative". A number of options may be provided as keyword arguments: module_relative If "module_relative" is True, then the given file paths are interpreted as os-independent module-relative paths. By default, these paths are relative to the calling module's directory; but if the "package" argument is specified, then they are relative to that package. To ensure os-independence, "filename" should use "/" characters to separate path segments, and may not be an absolute path (i.e., it may not begin with "/"). If "module_relative" is False, then the given file paths are interpreted as os-specific paths. These paths may be absolute or relative (to the current working directory). package A Python package or the name of a Python package whose directory should be used as the base directory for module relative paths. If "package" is not specified, then the calling module's directory is used as the base directory for module relative filenames. It is an error to specify "package" if "module_relative" is False. setUp A set-up function. This is called before running the tests in each file. The setUp function will be passed a DocTest object. The setUp function can access the test globals as the globs attribute of the test passed. tearDown A tear-down function. This is called after running the tests in each file. The tearDown function will be passed a DocTest object. The tearDown function can access the test globals as the globs attribute of the test passed. globs A dictionary containing initial global variables for the tests. optionflags A set of doctest option flags expressed as an integer. parser A DocTestParser (or subclass) that should be used to extract tests from the files. R`Ra(RoR~R1RkRKRR(tpathstkwRR((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pyR@s 5  cCs(g}xtj|D]}t|tr|j|jd |j}|r|jd|g|jdd D]}d|^qu7}qq|g|jdd D]}t|^q7}qWx$|r|ddkr|j qWx'|r|ddkr|j dqWdj |dS(Nis # Expected:s s## Rsi( RRR>R RRRlRfRvtpopR(RORtpieceRlR((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pyRs  4.cCs{t|}tj|}g|D]}|j|kr%|^q%}|s^t|dn|d}t|j}|S(sExtract the test sources from a doctest docstring as a script. Provide the module (or dotted name of the module) containing the test to be debugged and the name (within the module) of the object with the doc string with tests to be debugged. snot found in testsi(RKRRjR&RRR(RIR&RR*Rttestsrc((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pyRs ( cCs t|}t|||dS(s4Debug a single doctest docstring, in argument `src`'N(Rt debug_script(tsrctpmR5R((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pyRs cCsddl}tjdd}t|d}|j||jz|r\|j}ni}|ryt|||Wqtj dGH|j tj dqXn|j d|||Wdt j |XdS( s7Debug a test script. `src` is the script, as a string.iNs.pyt doctestdebugRqiis execfile(%r)(RyttempfiletmktempR^R3tcloseRtexecfileRDRVt post_mortemR;Rtremove(RRR5Ryt srcfilenameR)((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pyRs"   cCs2t|}t||}t|||jdS(sDebug a single doctest docstring. Provide the module (or dotted name of the module) containing the test to be debugged and the name (within the module) of the object with the docstring with tests to be debugged. N(RKRRR(RIR&RR((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pyR s (MRt __docformat__t__all__R/RDRSR<RRRMRoRJRyRR*R!tfilterwarningsR,R;R#RRRRRRRRRR R R RFReR R9RKRQR[R\RrRvRzRwRR RRRRRt ExceptionRRRR2RWRkRiRRRRRlRRpRnRRRRRRRRR R(((s5/sys/lib/python2.7/site-packages/nose/ext/dtcompat.pyt4s  H0                  ,  $5<4k r  tA QB F