Testing and Debugging Jupyter Notebooks
Jupyter notebook is a great tool
for a data scientist to create and share documents that contain code,
visualizations, and text. A combination of the notebook development
environment and a
reach Python data-science stack allows to
start with an idea sketch and develop it to a full featured data-science
project. At some point between the sketch and the finished project you may get
that unsettling feeling about changing some function or even a single line of
code, because you are not sure how this may impact the rest of the code. This
is a good moment to invest some time in writing
regression tests (if you
still have not done that). In this post I will show how to use Python standard
testing tools, such as
doctest
and
unittest
, to add tests to
a Jupyter notebook.