Skip to main content

Run doctests in individual IPython Notebook cells

Project description

Lets you run the doctests of a single class or function at a time. Useful for tutorials based on the IPython Notebook, using doctests for student feeback.

Install with pip install ipython_doctester, or navigate to this directory and run:

python setup.py install

Use

Run ipython notebook, then start your notebook with this import:

In [1]: from ipython_doctester import test

In each subsequent cell, set up objects with their doctests, and with absent (or flawed) function bodies, and decorate them with @test:

In [2]: @test
        def square(x):
            '''
            >>> f(2)
            4
            '''

Tests will run on each cell as it is executed.

If you want to track students’ progress through a notebook in a classroom setting, you can; see http://ipython-docent.appspot.com/ for instructions.

If no doctests are found in the function’s docstring, the program will look for a file ./docstrings/<function name>.txt, append that to the function’s docstring, and check for doctests again. This can be used to keep the presence of the docstrings from confusing students.

Development

https://github.com/catherinedevlin/ipython_doctester

Thanks to

Brian Granger for technical advice

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ipython_doctester-0.2.3.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

ipython_doctester-0.2.3-py2.7.egg (7.5 kB view details)

Uploaded Source

File details

Details for the file ipython_doctester-0.2.3.tar.gz.

File metadata

File hashes

Hashes for ipython_doctester-0.2.3.tar.gz
Algorithm Hash digest
SHA256 555ee779cf7b33b0a6ec17f6ccaa88a7836b4a8dadc592f1d50be41384614a8c
MD5 bc868c9775eda7be0c535ff77bfd7199
BLAKE2b-256 ab8a3a51019f5ddca1e83c338ce418b61120a20133748cf8a67af54cdea10d5d

See more details on using hashes here.

File details

Details for the file ipython_doctester-0.2.3-py2.7.egg.

File metadata

File hashes

Hashes for ipython_doctester-0.2.3-py2.7.egg
Algorithm Hash digest
SHA256 2eacec8ca2b917882413d135cf6dfc1bb6d71f525c87db93531fe62794f798af
MD5 38856bba83039f0983462f0a443390cf
BLAKE2b-256 3bb94e7eb144188a65b66bba65e4401d9190bdc5e296d58092e3dc79d3137a6f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page