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)
| 1984 | master = None |
| 1985 | |
| 1986 | def testmod(m=None, name=None, globs=None, verbose=None, |
| 1987 | report=True, optionflags=0, extraglobs=None, |
| 1988 | raise_on_error=False, exclude_empty=False): |
| 1989 | """m=None, name=None, globs=None, verbose=None, report=True, |
| 1990 | optionflags=0, extraglobs=None, raise_on_error=False, |
| 1991 | exclude_empty=False |
| 1992 | |
| 1993 | Test examples in docstrings in functions and classes reachable |
| 1994 | from module m (or the current module if m is not supplied), starting |
| 1995 | with m.__doc__. |
| 1996 | |
| 1997 | Also test examples reachable from dict m.__test__ if it exists. |
| 1998 | m.__test__ maps names to functions, classes and strings; |
| 1999 | function and class docstrings are tested even if the name is private; |
| 2000 | strings are tested directly, as if they were docstrings. |
| 2001 | |
| 2002 | Return (#failures, #tests). |
| 2003 | |
| 2004 | See help(doctest) for an overview. |
| 2005 | |
| 2006 | Optional keyword arg "name" gives the name of the module; by default |
| 2007 | use m.__name__. |
| 2008 | |
| 2009 | Optional keyword arg "globs" gives a dict to be used as the globals |
| 2010 | when executing examples; by default, use m.__dict__. A copy of this |
| 2011 | dict is actually used for each docstring, so that each docstring's |
| 2012 | examples start with a clean slate. |
| 2013 | |
| 2014 | Optional keyword arg "extraglobs" gives a dictionary that should be |
| 2015 | merged into the globals that are used to execute examples. By |
| 2016 | default, no extra globals are used. This is new in 2.4. |
| 2017 | |
| 2018 | Optional keyword arg "verbose" prints lots of stuff if true, prints |
| 2019 | only failures if false; by default, it's true iff "-v" is in sys.argv. |
| 2020 | |
| 2021 | Optional keyword arg "report" prints a summary at the end when true, |
| 2022 | else prints nothing at the end. In verbose mode, the summary is |
| 2023 | detailed, else very brief (in fact, empty if all tests passed). |
| 2024 | |
| 2025 | Optional keyword arg "optionflags" or's together module constants, |
| 2026 | and defaults to 0. This is new in 2.3. Possible values (see the |
| 2027 | docs for details): |
| 2028 | |
| 2029 | DONT_ACCEPT_TRUE_FOR_1 |
| 2030 | DONT_ACCEPT_BLANKLINE |
| 2031 | NORMALIZE_WHITESPACE |
| 2032 | ELLIPSIS |
| 2033 | SKIP |
| 2034 | IGNORE_EXCEPTION_DETAIL |
| 2035 | REPORT_UDIFF |
| 2036 | REPORT_CDIFF |
| 2037 | REPORT_NDIFF |
| 2038 | REPORT_ONLY_FIRST_FAILURE |
| 2039 | |
| 2040 | Optional keyword arg "raise_on_error" raises an exception on the |
| 2041 | first unexpected exception or failure. This allows failures to be |
| 2042 | post-mortem debugged. |
| 2043 |
no test coverage detected