On this page
doctest.testsource
Prev: doctest.testmod | Up: doctest | Next: doctest.UnexpectedException
Rel: doctest.debug, doctest.debug_src, doctest.DebugRunner, doctest.DocFileSuite
Ref: docs.python.org — doctest.testsource
Tags: #public #python3 #stdlib #doctest
Import
import doctest
from doctest import testsource
Signature & Overview
doctest.testsource(module, name)
Extract the test sources from a doctest docstring as a script.
Usage
import doctest
# Extracts the Python script representation of doctests for a named object in a module
assert callable(doctest.testsource)
Gotchas
- Used internally by
doctest.debug().
REPL Inspect
from doctest import testsource
help(testsource)
Linked from
Related notes
- tuts/python3/stdlib_module/doctest/testmod Linked here; links to this page; shared tags: #doctest, #stdlib
- tuts/python3/stdlib_module/doctest/UnexpectedException Linked here; links to this page; shared tags: #doctest, #stdlib
- tuts/python3/stdlib_module/doctest/debug Linked here; shared tags: #doctest, #stdlib
- tuts/python3/stdlib_module/doctest/debug_src Linked here; shared tags: #doctest, #stdlib
- tuts/python3/stdlib_module/doctest/DebugRunner Linked here; shared tags: #doctest, #stdlib
- tuts/python3/stdlib_module/doctest/DocFileSuite Linked here; shared tags: #doctest, #stdlib
- tuts/python3/stdlib_module/doctest/DocTest Linked here; shared tags: #doctest, #stdlib
- tuts/python3/stdlib_module/doctest links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/doctest/DocTestFailure shared tags: #doctest, #stdlib
- tuts/python3/stdlib_module/doctest/DocTestFinder shared tags: #doctest, #stdlib