Skip to content

Commit

Permalink
✅ Using a jupyter notebook to doctest jupyter notebooks
Browse files Browse the repository at this point in the history
Closes #10. Created a handy jupyter notebook with scripts to parse jupyter notebooks and execute doctests within the function calls! Added a few unit tests as a start to some (but not all) functions in data_prep.ipynb and srgan_train.ipynb. Fits with ease of use by allowing debugging in a jupyter notebook, but not (yet) compatible with code coverage solutions showing you % coverage of your code.

Also note that matplotlib inline magic was removed, as plots still get plotted, and it doesn't work so well (sometimes) when you parse the .ipynb to a .py file with such magics. Created a download_to_path function in data_prep.ipynb as it's hard to create a test for the other functions requiring a big data file as input.
  • Loading branch information
weiji14 committed Oct 18, 2018
1 parent fff29f9 commit 70d1eee
Show file tree
Hide file tree
Showing 6 changed files with 495 additions and 22 deletions.
2 changes: 2 additions & 0 deletions Pipfile
Expand Up @@ -23,6 +23,8 @@ toolz = "==0.9.0"
tqdm = "==4.27.0"

[dev-packages]
nbval = "==0.9.1"
pytest = "==3.9.1"

[requires]
python_version = "3.6"
Expand Down
287 changes: 285 additions & 2 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -39,7 +39,8 @@ Also a convenient [flat file](https://en.wikipedia.org/wiki/Flat-file_database)
├── README.md (the markdown file you're reading now)
├── data_prep.ipynb (jupyter notebook that prepares the data)
├── environment.yml (conda packages to install, used by binder)
└── srgan_train.ipynb (jupyter notebook that trains the Super Resolution Generative Adversarial Network model)
├── srgan_train.ipynb (jupyter notebook that trains the Super Resolution Generative Adversarial Network model)
└── test_ipynb.ipynb (jupyter notebook that runs doctests in the other jupyter notebooks!)
```
</details>

Expand Down

0 comments on commit 70d1eee

Please sign in to comment.