From 416e1abb102ab3fd5fe266853109c370e74070cf Mon Sep 17 00:00:00 2001 From: Ralf Gommers Date: Tue, 17 Apr 2012 23:04:59 +0200 Subject: DOC: fix link and add explanation on how to run examples. --- doc/HOWTO_DOCUMENT.rst.txt | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'doc') diff --git a/doc/HOWTO_DOCUMENT.rst.txt b/doc/HOWTO_DOCUMENT.rst.txt index 6ca5dd0f8..8186c472d 100644 --- a/doc/HOWTO_DOCUMENT.rst.txt +++ b/doc/HOWTO_DOCUMENT.rst.txt @@ -358,7 +358,7 @@ The sections of the docstring are: 11. **Examples** An optional section for examples, using the `doctest - `_ format. + `_ format. This section is meant to illustrate usage, not to provide a testing framework -- for that, use the ``tests/`` directory. While optional, this section is very strongly encouraged. @@ -382,9 +382,23 @@ The sections of the docstring are: >>> np.random.rand(2) array([ 0.35773152, 0.38568979]) #random - You can run examples using:: + You can run examples as doctests using:: >>> np.test(doctests=True) + >>> np.linalg.test(doctests=True) # for a single module + + In IPython it is also possible to run individual examples simply by + copy-pasting them in doctest mode:: + + In [1]: %doctest_mode + Exception reporting mode: Plain + Doctest mode is: ON + >>> %paste + import numpy.random + np.random.rand(2) + ## -- End pasted text -- + array([ 0.8519522 , 0.15492887]) + It is not necessary to use the doctest markup ```` to indicate empty lines in the output. Note that the option to run -- cgit v1.2.1