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

Function testsource

Lib/doctest.py:2725–2739  ·  view source on GitHub ↗

Extract the test sources from a doctest docstring as a script. Provide the module (or dotted name of the module) containing the test to be debugged and the name (within the module) of the object with the doc string with tests to be debugged.

(module, name)

Source from the content-addressed store, hash-verified

2723 return '\n'.join(output) + '\n'
2724
2725def testsource(module, name):
2726 """Extract the test sources from a doctest docstring as a script.
2727
2728 Provide the module (or dotted name of the module) containing the
2729 test to be debugged and the name (within the module) of the object
2730 with the doc string with tests to be debugged.
2731 """
2732 module = _normalize_module(module)
2733 tests = DocTestFinder().find(module)
2734 test = [t for t in tests if t.name == name]
2735 if not test:
2736 raise ValueError(name, "not found in tests")
2737 test = test[0]
2738 testsrc = script_from_examples(test.docstring)
2739 return testsrc
2740
2741def debug_src(src, pm=False, globs=None):
2742 """Debug a single doctest docstring, in argument `src`"""

Callers 1

debugFunction · 0.85

Calls 4

_normalize_moduleFunction · 0.85
DocTestFinderClass · 0.85
script_from_examplesFunction · 0.85
findMethod · 0.45

Tested by

no test coverage detected