I wrote an article about Doctest in python and provide example on how to use them in several contexts.

Read the full article: https://fatalement.com/posts/doctest/