doctest.DocTestParser.parse()

parse(string, name='') 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.

doctest.DocTestParser.get_examples()

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.

doctest.DocTestFailure.got

DocTestFailure.got The example’s actual output.

doctest.DocTestFinder

class doctest.DocTestFinder(verbose=False, parser=DocTestParser(), recurse=True, exclude_empty=True) A processing class used to extract the DocTests that are relevant to a given object, from its docstring and the docstrings of its contained objects. DocTests can be extracted from modules, classes, functions, methods, staticmethods, classmethods, and properties. The optional argument verbose can be used to display the objects searched by the finder. It defaults to False (no output). The optio

doctest.DocTestFinder.find()

find(obj[, name][, module][, globs][, extraglobs]) Return a list of the DocTests that are defined by obj‘s docstring, or by any of its contained objects’ docstrings. The optional argument name specifies the object’s name; this name will be used to construct names for the returned DocTests. If name is not specified, then obj.__name__ is used. The optional parameter module is the module that contains the given object. If the module is not specified or is None, then the test finder will attempt

doctest.DocTestFailure.test

DocTestFailure.test The DocTest object that was being run when the example failed.

doctest.DocTestFailure

exception doctest.DocTestFailure(test, example, got) An exception raised by DocTestRunner to signal that a doctest example’s actual output did not match its expected output. The constructor arguments are used to initialize the attributes of the same names.

doctest.DocTest.globs

globs The namespace (aka globals) that the examples should be run in. This is a dictionary mapping names to values. Any changes to the namespace made by the examples (such as binding new variables) will be reflected in globs after the test is run.

doctest.DocTest.lineno

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.

doctest.DocTestFailure.example

DocTestFailure.example The Example that failed.