MCPcopy Index your code
hub / github.com/python/cpython / testmod

Function testmod

Lib/doctest.py:2013–2115  ·  view source on GitHub ↗

m=None, name=None, globs=None, verbose=None, report=True, optionflags=0, extraglobs=None, raise_on_error=False, exclude_empty=False Test examples in docstrings in functions and classes reachable from module m (or the current module if m is not supplied), starting with m.__

(m=None, name=None, globs=None, verbose=None,
            report=True, optionflags=0, extraglobs=None,
            raise_on_error=False, exclude_empty=False)

Source from the content-addressed store, hash-verified

2011master = None
2012
2013def testmod(m=None, name=None, globs=None, verbose=None,
2014 report=True, optionflags=0, extraglobs=None,
2015 raise_on_error=False, exclude_empty=False):
2016 """m=None, name=None, globs=None, verbose=None, report=True,
2017 optionflags=0, extraglobs=None, raise_on_error=False,
2018 exclude_empty=False
2019
2020 Test examples in docstrings in functions and classes reachable
2021 from module m (or the current module if m is not supplied), starting
2022 with m.__doc__.
2023
2024 Also test examples reachable from dict m.__test__ if it exists.
2025 m.__test__ maps names to functions, classes and strings;
2026 function and class docstrings are tested even if the name is private;
2027 strings are tested directly, as if they were docstrings.
2028
2029 Return (#failures, #tests).
2030
2031 See help(doctest) for an overview.
2032
2033 Optional keyword arg "name" gives the name of the module; by default
2034 use m.__name__.
2035
2036 Optional keyword arg "globs" gives a dict to be used as the globals
2037 when executing examples; by default, use m.__dict__. A copy of this
2038 dict is actually used for each docstring, so that each docstring's
2039 examples start with a clean slate.
2040
2041 Optional keyword arg "extraglobs" gives a dictionary that should be
2042 merged into the globals that are used to execute examples. By
2043 default, no extra globals are used. This is new in 2.4.
2044
2045 Optional keyword arg "verbose" prints lots of stuff if true, prints
2046 only failures if false; by default, it's true iff "-v" is in sys.argv.
2047
2048 Optional keyword arg "report" prints a summary at the end when true,
2049 else prints nothing at the end. In verbose mode, the summary is
2050 detailed, else very brief (in fact, empty if all tests passed).
2051
2052 Optional keyword arg "optionflags" or's together module constants,
2053 and defaults to 0. This is new in 2.3. Possible values (see the
2054 docs for details):
2055
2056 DONT_ACCEPT_TRUE_FOR_1
2057 DONT_ACCEPT_BLANKLINE
2058 NORMALIZE_WHITESPACE
2059 ELLIPSIS
2060 SKIP
2061 IGNORE_EXCEPTION_DETAIL
2062 REPORT_UDIFF
2063 REPORT_CDIFF
2064 REPORT_NDIFF
2065 REPORT_ONLY_FIRST_FAILURE
2066
2067 Optional keyword arg "raise_on_error" raises an exception on the
2068 first unexpected exception or failure. This allows failures to be
2069 post-mortem debugged.
2070

Callers 1

_testFunction · 0.85

Calls 10

findMethod · 0.95
runMethod · 0.95
summarizeMethod · 0.95
DocTestFinderClass · 0.85
DebugRunnerClass · 0.85
DocTestRunnerClass · 0.85
TestResultsClass · 0.70
getMethod · 0.45
ismoduleMethod · 0.45
mergeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…