[IPython-User] Doctest checker in IPython notebook

Takafumi Arakaki aka.tkf@gmail....
Thu Oct 11 13:27:08 CDT 2012


I haven't posted in the extension wiki, but I also made a doctest magic
extension.  This is rather for using ipdb, not for fancy result
printing.  It defines a line magic for running doctests in python
object and a cell magic for running doctests in the cell.
https://github.com/tkf/ipython-doctestmagic

Takafumi

Brian Granger <ellisonbg@gmail.com> writes:

> Catherine,
>
> Hi, this looks really great!  We would love to work with you to make
> this an actual IPython library or extension.  If you are interested in
> working with us, let's use this thread to discuss where you see this
> heading and the best way to incorporate it into the project.  Of
> course, feel free to continue to work on this on your own as well.
>
> Cheers,
>
> Brian
>
> On Thu, Oct 11, 2012 at 8:34 AM, Thomas Kluyver <takowl@gmail.com> wrote:
>> 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:
>>
>> http://catherinedevlin.blogspot.co.uk/2012/10/im-increasingly-amazed-at-ipython.html
>>
>> 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:
>>
>> %%check_cases
>> cube(3) == 27
>> cube(-2) == -8
>>
>> Thomas
>> _______________________________________________
>> IPython-User mailing list
>> IPython-User@scipy.org
>> http://mail.scipy.org/mailman/listinfo/ipython-user


More information about the IPython-User mailing list