File: doctest_directive.txt

package info (click to toggle)
python-sybil 9.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,164 kB
  • sloc: python: 4,545; makefile: 90
file content (20 lines) | stat: -rw-r--r-- 354 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Who knew that you could have a doctest role?
You have to make sure to enable "sphinx.ext.doctest"...

.. doctest::

    >>> 1 + 1
    2

This is what it looks like when output doesn't match expectations:

.. doctest::

    >>> 1 + 1
    Unexpected!

This is what it looks like when an exception is raised:

.. doctest::

    >>> raise Exception('boom!')