Another blog post from OPIG awhile ago on automated testing using the doctest module in Python:

https://www.blopig.com/blog/2018/12/automated-testing-with-doctest/