doctest.DocTestFailure.example

DocTestFailure.example The Example that failed.

doctest.DocFileSuite()

doctest.DocFileSuite(*paths, module_relative=True, package=None, setUp=None, tearDown=None, globs=None, optionflags=0, parser=DocTestParser(), encoding=None) Convert doctest tests from one or more text files to a unittest.TestSuite. The returned unittest.TestSuite is to be run by the unittest framework and runs the interactive examples in each file. If an example in any file fails, then the synthesized unit test fails, and a failureException exception is raised showing the name of the file c

doctest.DocTest

class doctest.DocTest(examples, globs, name, filename, lineno, docstring) A collection of doctest examples that should be run in a single namespace. The constructor arguments are used to initialize the attributes of the same names. DocTest defines the following attributes. They are initialized by the constructor, and should not be modified directly. examples A list of Example objects encoding the individual interactive Python examples that should be run by this test. globs The names

doctest.DocTest.examples

examples A list of Example objects encoding the individual interactive Python examples that should be run by this test.

doctest.DocTest.docstring

docstring The string that the test was extracted from, or ‘None’ if the string is unavailable, or if the test was not extracted from a string.

doctest.DocTest.filename

filename The name of the file that this DocTest was extracted from; or None if the filename is unknown, or if the DocTest was not extracted from a file.

doctest.DebugRunner

class doctest.DebugRunner(checker=None, verbose=None, optionflags=0) A subclass of DocTestRunner that raises an exception as soon as a failure is encountered. If an unexpected exception occurs, an UnexpectedException exception is raised, containing the test, the example, and the original exception. If the output doesn’t match, then a DocTestFailure exception is raised, containing the test, the example, and the actual output. For information about the constructor parameters and methods, see t

doctest.debug_src()

doctest.debug_src(src, pm=False, globs=None) Debug the doctests in a string. This is like function debug() above, except that a string containing doctest examples is specified directly, via the src argument. Optional argument pm has the same meaning as in function debug() above. Optional argument globs gives a dictionary to use as both local and global execution context. If not specified, or None, an empty dictionary is used. If specified, a shallow copy of the dictionary is used.

doctest.debug()

doctest.debug(module, name, pm=False) Debug the doctests for an object. The module and name arguments are the same as for function testsource() above. The synthesized Python script for the named object’s docstring is written to a temporary file, and then that file is run under the control of the Python debugger, pdb. A shallow copy of module.__dict__ is used for both local and global execution context. Optional argument pm controls whether post-mortem debugging is used. If pm has a true valu

dis.stack_effect()

dis.stack_effect(opcode[, oparg]) Compute the stack effect of opcode with argument oparg. New in version 3.4.