← Browse all tools

Go Back
Report Abuse

doctest

Python standard library module testing interactive examples in documentation

Tool overview

doctest is a module of the Python standard library that searches for text that looks like interactive Python sessions, such as examples in docstrings, and executes them to verify that they produce the documented results. It is used to keep documentation examples up to date, for regression testing from text files, and for executable documentation.

doctest can be run from a module, from the command line (python -m doctest) or integrated with unittest. Option flags relax comparisons where output varies.

Screenshots & video

doctest_error
doctest_error

Community reviews

Login to Write Your Review

There are no reviews yet.

Source & attribution

Original contributor
Jean-Baptiste CROUIGNEAU
External references
https://docs.python.org/3/library/doctest.html