On Wed, Dec 21, 2011 at 8:03 AM, Thomas Kluyver <[email protected]> wrote: > On 21 December 2011 14:38, Aaron Meurer <[email protected]> wrote: >> >> > In the meantime, to turn a notebook into doctests, you could run the >> > cells >> > and then use "%hist -pof doctests.py 1-12" (the options mean [p]rompts, >> > [o]utput and [f]ile). >> >> This should work for now. Is is possible to generate these files >> automatically from the test runner? > > > That suggestion relies on execution history, so you'd need to create an > InteractiveShell object, load the notebook, run the cells, and then use that > magic command to save it as doctests. So it's possible, but a bit involved. > > You can load a notebook and save it as Python code with a couple of function > calls: > http://ipython.org/ipython-doc/dev/api/generated/IPython.nbformat.current.html#IPython.nbformat.current.read > http://ipython.org/ipython-doc/dev/api/generated/IPython.nbformat.current.html#IPython.nbformat.current.write > > But that isn't quite suitable for doctests - output is in comments, and > input doesn't have prompts before it. I think it's easy for us to add > 'doctest' as another format option, but of course it will only be in the > development version. > > Thanks, > Thomas
Well, the converting of our examples won't actually happen until someone gets around to doing it anyway. So I think we can reasonably wait until better doctest support is added, and do it when IPython 0.13 comes out (or whatever version ends up having it). That certainly would be a killer feature if I could just do "ipython notebook --doctest file.ipnb" (or something similar), and it would doctest it. Shall I open an issue for this, or does one already exist? Aaron Meurer -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
