[IPython-User] Doctest checker in IPython notebook

Thomas Kluyver takowl@gmail....
Thu Oct 11 10:34:41 CDT 2012

I spotted this on Planet Python. Catherine Devlin (CCed) has made a
tool to doctest a function and display the results in a nice HTML
format, for use with the notebook:


In the discussion recently about teaching with the notebook, we
mentioned the possibility of homework notebooks where the student has
to fill in code, so something like this could be really useful.

I wonder if there's a better way than using doctests, though (doctests
being my pet hate)? It would be easy to define a list of input/output
pairs, but all the tuples involved would make writing the tests
awkward. Maybe a cell magic:

cube(3) == 27
cube(-2) == -8


More information about the IPython-User mailing list