Introduction to doctest Module

Let's explore doctest module and how it can be useful.

We'll cover the following...

Python includes a really useful module in its standard library that is called doctest. The doctest module will look at our code and determine if we have any text that looks like an interactive Python session. Then doctest will execute those given strings for testing to verify that they work the way they are written.

According to the Python documentation, doctest has three primary uses:

  • Checking that a module’s
...