doctest

Stdlib — TestingPython 2.0+Beginner

Test code examples embedded in docstrings

Quick Info

Documentation
Official Docs
Python Version
2.0+
Dependencies
None — Python Standard Library
Install
Included with Python

Learn by Difficulty

Quick Example

python
import doctest

print(f"Module: doctest")
print(f"Contents: {dir(doctest)[:10]}")

The doctest module is part of Python's standard library. Test code examples embedded in docstrings.

Try in Playground

Tags

stdlibtestingdebugging