Sample code for Chapter 1 of Fluent Python 2e by Luciano Ramalho (O'Reilly, 2020)
Use Python's standard doctest
module to check stand-alone doctest file:
$ python3 -m doctest frenchdeck.doctest -v
And to check doctests embedded in a module:
$ python3 -m doctest vector2d.py -v
Install pytest
and the nbval
plugin:
$ pip install pytest nbval
Run:
$ pytest --nbval