Inheritance diagram for IPython.testing.mkdoctests:
Utility for making a doctest file out of Python or IPython input.
%prog [options] input_file [output_file]
This script is a convenient generator of doctest files that uses IPython’s irunner script to execute valid Python or IPython input in a separate process, capture all of the output, and write it to an output file.
It can be used in one of two ways:
With a plain Python or IPython input file (denoted by extensions ‘.py’ or ‘.ipy’. In this case, the output is an auto-generated reST file with a basic header, and the captured Python input and output contained in an indented code block.
If no output filename is given, the input name is used, with the extension replaced by ‘.txt’.
With an input template file. Template files are simply plain text files with special directives of the form
%run filename
to include the named file at that point.
If no output filename is given and the input filename is of the form ‘base.tpl.txt’, the output will be automatically named ‘base.txt’.
Bases: object
A simple output stream that indents all output by a fixed amount.
Instances of this class trap output to a given stream and first reformat it to indent every input line.
Create an indented writer.
Keywords : |
---|
Write a string to the output stream.
Bases: object
Code runner factory.
This class provides an IPython code runner, but enforces that only one runner is every instantiated. The runner is created based on the extension of the first file to run, and it raises an exception if a runner is later requested for a different extension type.
This ensures that we don’t generate example files for doctest with a mix of python and ipython syntax.
Instantiate a code runner.