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)
| 2799 | return '\n'.join(output) + '\n' |
| 2800 | |
| 2801 | def testsource(module, name): |
| 2802 | """Extract the test sources from a doctest docstring as a script. |
| 2803 | |
| 2804 | Provide the module (or dotted name of the module) containing the |
| 2805 | test to be debugged and the name (within the module) of the object |
| 2806 | with the doc string with tests to be debugged. |
| 2807 | """ |
| 2808 | module = _normalize_module(module) |
| 2809 | tests = DocTestFinder().find(module) |
| 2810 | test = [t for t in tests if t.name == name] |
| 2811 | if not test: |
| 2812 | raise ValueError(name, "not found in tests") |
| 2813 | test = test[0] |
| 2814 | testsrc = script_from_examples(test.docstring) |
| 2815 | return testsrc |
| 2816 | |
| 2817 | def debug_src(src, pm=False, globs=None): |
| 2818 | """Debug a single doctest docstring, in argument `src`""" |
no test coverage detected
searching dependent graphs…