doctest.DocTestFinder

class doctest.DocTestFinder(verbose=False, parser=<doctest.DocTestParser instance>, recurse=True, exclude_empty=True)[source]

A 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 currently be extracted from the following object types: modules, functions, classes, methods, staticmethods, classmethods, and properties.

Methods

__init__([verbose, parser, recurse, ...]) Create a new doctest finder.
_find(tests, obj, name, module, ...) Find tests for the given object and any contained objects, and add them to tests.
_find_lineno(obj, source_lines) Return a line number of the given object’s docstring.
_from_module(module, object) Return true if the given object is defined in the given module.
_get_test(obj, name, module, globs, source_lines) Return a DocTest for the given object, if it defines a docstring; otherwise, return None.
find(obj[, name, module, globs, extraglobs]) Return a list of the DocTests that are defined by the given object’s docstring, or by any of its contained objects’ docstrings.