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.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.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

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.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.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.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()

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

divmod()

divmod(a, b) Take two (non complex) numbers as arguments and return a pair of numbers consisting of their quotient and remainder when using integer division. With mixed operand types, the rules for binary arithmetic operators apply. For integers, the result is the same as (a // b, a % b). For floating point numbers the result is (q, a % b), where q is usually math.floor(a / b) but may be 1 less than that. In any case q * b + a % b is very close to a, if a % b is non-zero it has the same sign