doctest
Doctest is a testing framework in Python's standard library that extracts and executes small interactive Python examples embedded in code documentation. It reads docstrings, finds blocks that look like an interactive session (lines starting with >>> and subsequent output lines), runs the code, and checks that the actual output matches the expected output in the docstring. The goal is to ensure that examples in documentation stay correct and serve as lightweight tests for the public API.
Usage is centered on running tests against modules or files. The doctest module provides functions such as
Limitations and practice: Doctest is best for straightforward, text-based outputs and examples that are stable. It