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

Aaron Meurer asmeurer at gmail.com
Thu Dec 5 18:57:02 EST 2013


I'd like to be able to do this without any metadata, and especially
without any magic. My use-case is that we have several example
notebooks for SymPy, which we'd like to ship with our tarball, but we
don't want to ship notebooks that don't work because they weren't
updated with the code.

Ideally, it should "just work".

Aaron Meurer

On Thu, Dec 5, 2013 at 4:13 PM, Greg Wilson <gvwilson at third-bit.com> wrote:
> Is this another case where named cells would be useful?
>
> %%test name_of_cell_to_compare_code_against
> ...code...
>
> and then further down, a Markdown cell with a name ?
>
> Thanks,
> Greg
>
> On 2013-12-05 5:44 PM, Aaron Meurer wrote:
>> Here's the relevant issue:
>> https://github.com/ipython/ipython/issues/1195. I would love to see
>> something like this integrated into IPython.
>>
>> Aaron Meurer
>>
>> On Thu, Dec 5, 2013 at 3:42 PM, MinRK <benjaminrk at gmail.com> wrote:
>>> I wrote a toy script a while ago, to show that this kind of thing is
>>> feasible:
>>>
>>> https://gist.github.com/minrk/2620735
>>>
>>> -MinRK
>>>
>>>
>>> On Thu, Dec 5, 2013 at 1:00 PM, Martín Gaitán <gaitan at phasety.com> wrote:
>>>> 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
>>>>
>>>> _______________________________________________
>>>> IPython-dev mailing list
>>>> IPython-dev at scipy.org
>>>> http://mail.scipy.org/mailman/listinfo/ipython-dev
>>>>
>>>
>>> _______________________________________________
>>> IPython-dev mailing list
>>> IPython-dev at scipy.org
>>> http://mail.scipy.org/mailman/listinfo/ipython-dev
>>>
>> _______________________________________________
>> IPython-dev mailing list
>> IPython-dev at scipy.org
>> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev



More information about the IPython-dev mailing list