Using doctest-mode inside rst-mode (1/4)

Note: To use doctest-mode within rst-mode, you must have mmm-mode installed, and enable doctest-mode's support for mmm-mode. See MMM-Mode Support for instructions. This walk-through assumes that mmm-mode support has already been enabled.

Open or create a reStructuredText file containing some doctest examples. The example to the right contains some tests for the stdlib math module.

Next Page...

Regression Tests for math
=========================
This is a mock-up file containing some regression tests for
the Python `math module`_.

.. _math module: http://docs.python.org/lib/module-math.html

>>> from math import *

Make sure that `math.floor()` handles negative numbers
correctly:

>>> [floor(x) for x in (-2.0, -1.5, -1.0, 1.0, 1.5, 2.0)]
[-2.0, -2.0, -1.0, 1.0, 1.0, 2.0]
.
Check for rounding errors on round trips:

>>> print sin(asin(0.5)), cos(acos(0.5))
0.5 0.5
ISO8---Emacs: mytest.rst   (reST Font)----L15--All---------------