diff options
author | Ralf Gommers <ralf.gommers@googlemail.com> | 2012-04-17 23:04:59 +0200 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2012-04-18 12:36:13 -0600 |
commit | 416e1abb102ab3fd5fe266853109c370e74070cf (patch) | |
tree | 9806d509b6de814022faf8bd21e781ffa3bc04a1 /doc | |
parent | dafb2dd0ea89821fe9c90c42e218869cc2025e9f (diff) | |
download | numpy-416e1abb102ab3fd5fe266853109c370e74070cf.tar.gz |
DOC: fix link and add explanation on how to run examples.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/HOWTO_DOCUMENT.rst.txt | 18 |
1 files changed, 16 insertions, 2 deletions
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 - <http://www.python.org/doc/lib/module-doctest.html>`_ format. + <http://docs.python.org/library/doctest.html>`_ 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 ``<BLANKLINE>`` to indicate empty lines in the output. Note that the option to run |