class doctest.DocTestParser
A processing class used to extract interactive examples from a string, and use them to create a DocTest
object.
DocTestParser
defines the following methods:
-
get_doctest(string, globs, name, filename, lineno)
-
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 forDocTest
for more information.
-
get_examples(string, name='')
-
Extract all doctest examples from the given string, and return them as a list of
Example
objects. Line numbers are 0-based. The optional argument name is a name identifying this string, and is only used for error messages.
-
parse(string, name='')
-
Divide the given string into examples and intervening text, and return them as a list of alternating
Example
s and strings. Line numbers for theExample
s are 0-based. The optional argument name is a name identifying this string, and is only used for error messages.
Please login to continue.