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 wit
(m=None, name=None, globs=None, verbose=None,
report=True, optionflags=0, extraglobs=None,
raise_on_error=False, exclude_empty=False)
| 1898 | master = None |
| 1899 | |
| 1900 | def testmod(m=None, name=None, globs=None, verbose=None, |
| 1901 | report=True, optionflags=0, extraglobs=None, |
| 1902 | raise_on_error=False, exclude_empty=False): |
| 1903 | """m=None, name=None, globs=None, verbose=None, report=True, |
| 1904 | optionflags=0, extraglobs=None, raise_on_error=False, |
| 1905 | exclude_empty=False |
| 1906 | |
| 1907 | Test examples in docstrings in functions and classes reachable |
| 1908 | from module m (or the current module if m is not supplied), starting |
| 1909 | with m.__doc__. |
| 1910 | |
| 1911 | Also test examples reachable from dict m.__test__ if it exists and is |
| 1912 | not None. m.__test__ maps names to functions, classes and strings; |
| 1913 | function and class docstrings are tested even if the name is private; |
| 1914 | strings are tested directly, as if they were docstrings. |
| 1915 | |
| 1916 | Return (#failures, #tests). |
| 1917 | |
| 1918 | See help(doctest) for an overview. |
| 1919 | |
| 1920 | Optional keyword arg "name" gives the name of the module; by default |
| 1921 | use m.__name__. |
| 1922 | |
| 1923 | Optional keyword arg "globs" gives a dict to be used as the globals |
| 1924 | when executing examples; by default, use m.__dict__. A copy of this |
| 1925 | dict is actually used for each docstring, so that each docstring's |
| 1926 | examples start with a clean slate. |
| 1927 | |
| 1928 | Optional keyword arg "extraglobs" gives a dictionary that should be |
| 1929 | merged into the globals that are used to execute examples. By |
| 1930 | default, no extra globals are used. This is new in 2.4. |
| 1931 | |
| 1932 | Optional keyword arg "verbose" prints lots of stuff if true, prints |
| 1933 | only failures if false; by default, it's true iff "-v" is in sys.argv. |
| 1934 | |
| 1935 | Optional keyword arg "report" prints a summary at the end when true, |
| 1936 | else prints nothing at the end. In verbose mode, the summary is |
| 1937 | detailed, else very brief (in fact, empty if all tests passed). |
| 1938 | |
| 1939 | Optional keyword arg "optionflags" or's together module constants, |
| 1940 | and defaults to 0. This is new in 2.3. Possible values (see the |
| 1941 | docs for details): |
| 1942 | |
| 1943 | DONT_ACCEPT_TRUE_FOR_1 |
| 1944 | DONT_ACCEPT_BLANKLINE |
| 1945 | NORMALIZE_WHITESPACE |
| 1946 | ELLIPSIS |
| 1947 | SKIP |
| 1948 | IGNORE_EXCEPTION_DETAIL |
| 1949 | REPORT_UDIFF |
| 1950 | REPORT_CDIFF |
| 1951 | REPORT_NDIFF |
| 1952 | REPORT_ONLY_FIRST_FAILURE |
| 1953 | |
| 1954 | Optional keyword arg "raise_on_error" raises an exception on the |
| 1955 | first unexpected exception or failure. This allows failures to be |
| 1956 | post-mortem debugged. |
| 1957 |
no test coverage detected