MCPcopy Index your code
hub / github.com/RustPython/RustPython / run_docstring_examples

Function run_docstring_examples

Lib/doctest.py:2215–2236  ·  view source on GitHub ↗

Test examples in the given object's docstring (`f`), using `globs` as globals. Optional argument `name` is used in failure messages. If the optional argument `verbose` is true, then generate output even if there are no failures. `compileflags` gives the set of flags that shoul

(f, globs, verbose=False, name="NoName",
                           compileflags=None, optionflags=0)

Source from the content-addressed store, hash-verified

2213
2214
2215def run_docstring_examples(f, globs, verbose=False, name="NoName",
2216 compileflags=None, optionflags=0):
2217 """
2218 Test examples in the given object's docstring (`f`), using `globs`
2219 as globals. Optional argument `name` is used in failure messages.
2220 If the optional argument `verbose` is true, then generate output
2221 even if there are no failures.
2222
2223 `compileflags` gives the set of flags that should be used by the
2224 Python compiler when running the examples. If not specified, then
2225 it will default to the set of future-import flags that apply to
2226 `globs`.
2227
2228 Optional keyword arg `optionflags` specifies options for the
2229 testing and output. See the documentation for `testmod` for more
2230 information.
2231 """
2232 # Find, parse, and run all tests in the given module.
2233 finder = DocTestFinder(verbose=verbose, recurse=False)
2234 runner = DocTestRunner(verbose=verbose, optionflags=optionflags)
2235 for test in finder.find(f, name, globs=globs):
2236 runner.run(test, compileflags=compileflags)
2237
2238######################################################################
2239## 7. Unittest Support

Callers

nothing calls this directly

Calls 4

findMethod · 0.95
runMethod · 0.95
DocTestFinderClass · 0.85
DocTestRunnerClass · 0.85

Tested by

no test coverage detected