[IPython-dev] IPy notebook as simple test system?

Martín Gaitán gaitan at phasety.com
Thu Dec 5 16:00:04 EST 2013


Hi everybody

I need to add some tests to fortran-magic [1] and I realized that,
basically, I should test each example in the documentation which is already
done as a notebook[2] .

So, I got this idea: make a a way to run the code cells of a notebook and
compare the calculated output against the stored output in the notebook.

Looking for something like this I found [3] and [4], which facilitate the
use of doctests, but it's not exactly the same. Conceptually, this are also
doctests, but the main difference with what I imagine is that we don't
bother writing fake code inside the actual code: No docstrings at all, just
use the cells we already have.

Of course the comparison should be flexible. Doctest has directives to
allow ellipsis or normalizations, for example [5]. I think this could be
simplified with an UI to select the portions of the output that must be
compared and store this selection as cell metadata.

What do you think?

[1] https://github.com/mgaitan/fortran_magic
[2]
http://nbviewer.ipython.org/github/mgaitan/fortran_magic/blob/master/documentation.ipynb
[3]
http://catherinedevlin.blogspot.co.uk/2012/10/im-increasingly-amazed-at-ipython.html
[4] https://github.com/tkf/ipython-doctestmagic
[5] http://docs.python.org/2/library/doctest.html#directives
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20131205/e8f61c42/attachment.html>


More information about the IPython-dev mailing list