Writing unit tests for notebooks within the notebooks themselves can lead to a messy notebook.
testbook allows unit tests to be run against notebooks in separate test files, effectively treating .ipynb files as .py files.
Link to testbook.