dtutils

Module: dtutils

Doctest-related utilities for IPython.

For most common uses, all you should need to run is:

from IPython.dtutils import idoctest

See the idoctest docstring below for usage details.

Functions

IPython.dtutils.idoctest(ns=None, eraise=False)

Interactively prompt for input and run it as a doctest.

To finish entering input, enter two blank lines or Ctrl-D (EOF). If you use Ctrl-C, the example is aborted and all input discarded.

Keywords:
ns : dict (None)

Namespace where the code should be executed. If not given, the IPython interactive namespace is used.

eraise : bool (False)

If true, immediately raise any exceptions instead of reporting them at the end. This allows you to then do interactive debugging via IPython’s facilities (use %debug after the fact, or with %pdb for automatic activation).

end_mark : str (‘–’)

String to explicitly indicate the end of input.

IPython.dtutils.rundoctest(text, ns=None, eraise=False)

Run a the input source as a doctest, in the caller’s namespace.

Parameters:
text : str

Source to execute.

Keywords:
ns : dict (None)

Namespace where the code should be executed. If not given, the caller’s locals and globals are used.

eraise : bool (False)

If true, immediately raise any exceptions instead of reporting them at the end. This allows you to then do interactive debugging via IPython’s facilities (use %debug after the fact, or with %pdb for automatic activation).

Table Of Contents

Previous topic

demo

Next topic

excolors

This Page

Quick search