diff options
| author | Jacob Mason <jacoblmason@gmail.com> | 2010-08-16 09:33:09 -0500 |
|---|---|---|
| committer | Jacob Mason <jacoblmason@gmail.com> | 2010-08-16 09:33:09 -0500 |
| commit | 5bebbf711506484f61d1105b985690d3b6d6879c (patch) | |
| tree | 34930a42efaad50f5473ae0aeea623eb37d7b98a /tests/root | |
| parent | ae5669cacc2d667358cce19e5974c2855dac1de1 (diff) | |
| parent | 9278752f495e35c134609bd77cd98ee9c67b348a (diff) | |
| download | sphinx-5bebbf711506484f61d1105b985690d3b6d6879c.tar.gz | |
merge with trunk
Diffstat (limited to 'tests/root')
| -rw-r--r-- | tests/root/doctest.txt | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/tests/root/doctest.txt b/tests/root/doctest.txt index 6ac0b286..ba9a72c5 100644 --- a/tests/root/doctest.txt +++ b/tests/root/doctest.txt @@ -50,23 +50,24 @@ Special directives .. testsetup:: * - from math import factorial + def squared(x): + return x * x .. doctest:: - >>> factorial(1) - 1 + >>> squared(2) + 4 .. testcode:: - print(factorial(1)) + print(squared(2)) .. testoutput:: - 1 + 4 - >>> factorial(1) - 1 + >>> squared(2) + 4 * options for testcode/testoutput blocks @@ -85,36 +86,38 @@ Special directives .. testsetup:: group1 - from math import trunc + def add(x, y): + return x + y - ``trunc`` is now known in "group1", but not in others. + + ``add`` is now known in "group1", but not in others. .. doctest:: group1 - >>> trunc(1.1) - 1 + >>> add(1, 1) + 2 .. doctest:: group2 - >>> trunc(1.1) + >>> add(1, 1) Traceback (most recent call last): ... - NameError: name 'trunc' is not defined + NameError: name 'add' is not defined Interleaving testcode/testoutput: .. testcode:: group1 - print(factorial(3)) + print(squared(3)) .. testcode:: group2 - print(factorial(4)) + print(squared(4)) .. testoutput:: group1 - 6 + 9 .. testoutput:: group2 - 24 + 16 |
