Trees | Index | Help |
|
---|
Package zope :: Package testing :: Module doctest :: Class DocTestParser |
|
A class used to parse strings containing doctest examples.
Method Summary | |
---|---|
Extract all doctest examples from the given string, and collect them into a DocTest object. | |
Extract all doctest examples from the given string, and return them as a list of Example objects. | |
Divide the given string into examples and intervening text, and return them as a list of alternating Examples and strings. | |
Check that every line in the given list starts with the given prefix; if any line does not, then raise a ValueError. | |
Given the lines of a source string (including prompts and leading indentation), check to make sure that every prompt is followed by a space character. | |
Return a dictionary containing option overrides extracted from option directives in the given source string. | |
Return the minimum indentation of any non-blank line in 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). | |
Inherited from SRE_Pattern | |
match(string[, pos[, endpos]]) --> match object or None. |
Class Variable Summary | |
---|---|
SRE_Pattern |
_EXAMPLE_RE = ((?:^( *)>>>.*)(?:\n *\.\.\..*)*)\n?((?:(?...
|
SRE_Pattern |
_EXCEPTION_RE = ^(Traceback \((?:most recent call last|i...
|
SRE_Pattern |
_INDENT_RE = ^( *)(?=\S)
|
SRE_Pattern |
_OPTION_DIRECTIVE_RE = #\s*doctest:\s*([^\n'"]*)$
|
Method Details |
---|
get_doctest(self, string, globs, name, filename, lineno)Extract all doctest examples from the given string, and
collect them into a
|
get_examples(self, string, name='<string>')Extract all doctest examples from the given string, and return
them as a list of The optional argument |
parse(self, string, name='<string>')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 |
_check_prefix(self, lines, prefix, name, lineno)Check that every line in the given list starts with the given prefix; if any line does not, then raise a ValueError. |
_check_prompt_blank(self, lines, indent, name, lineno)Given the lines of a source string (including prompts and leading indentation), check to make sure that every prompt is followed by a space character. If any line is not followed by a space character, then raise ValueError. |
_find_options(self, source, name, lineno)Return a dictionary containing option overrides extracted from option directives in the given source string.
|
_min_indent(self, s)Return the minimum indentation of any non-blank line in |
_parse_example(self, m, name, lineno)Given a regular expression match from
|
Class Variable Details |
---|
_EXAMPLE_RE
|
_EXCEPTION_RE
|
_INDENT_RE
|
_OPTION_DIRECTIVE_RE
|
Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Fri Jun 24 12:01:21 2005 | http://epydoc.sf.net |