summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDasIch <dasdasich@gmail.com>2010-06-19 21:50:00 +0200
committerDasIch <dasdasich@gmail.com>2010-06-19 21:50:00 +0200
commit64b37e03e42f94ddd9486d0afd1ffd5e47cc1f4e (patch)
treeb532d4463cc038d57e38729555926b120d33e2c6 /tests
parent0d055b80a97daaa29c49a2b0e507d60fa7a0e9a3 (diff)
downloadsphinx-64b37e03e42f94ddd9486d0afd1ffd5e47cc1f4e.tar.gz
make doctest work with python2 and python3
Diffstat (limited to 'tests')
-rw-r--r--tests/root/conf.py2
-rw-r--r--tests/root/doctest.txt38
2 files changed, 20 insertions, 20 deletions
diff --git a/tests/root/conf.py b/tests/root/conf.py
index 2b6d6a9a..b4734189 100644
--- a/tests/root/conf.py
+++ b/tests/root/conf.py
@@ -22,7 +22,7 @@ copyright = '2010, Georg Brandl & Team'
version = '0.6'
release = '0.6alpha1'
today_fmt = '%B %d, %Y'
-#unused_docs = []
+# unused_docs = []
exclude_patterns = ['_build', '**/excluded.*']
keep_warnings = True
pygments_style = 'sphinx'
diff --git a/tests/root/doctest.txt b/tests/root/doctest.txt
index 35cdd589..6ac0b286 100644
--- a/tests/root/doctest.txt
+++ b/tests/root/doctest.txt
@@ -30,7 +30,7 @@ Special directives
.. testcode::
- print 1+1
+ print(1+1)
.. testoutput::
@@ -50,30 +50,30 @@ Special directives
.. testsetup:: *
- from math import floor
+ from math import factorial
.. doctest::
- >>> floor(1.2)
- 1.0
+ >>> factorial(1)
+ 1
.. testcode::
- print floor(1.2)
+ print(factorial(1))
.. testoutput::
- 1.0
+ 1
- >>> floor(1.2)
- 1.0
+ >>> factorial(1)
+ 1
* options for testcode/testoutput blocks
.. testcode::
:hide:
- print 'Output text.'
+ print('Output text.')
.. testoutput::
:hide:
@@ -85,36 +85,36 @@ Special directives
.. testsetup:: group1
- from math import ceil
+ from math import trunc
- ``ceil`` is now known in "group1", but not in others.
+ ``trunc`` is now known in "group1", but not in others.
.. doctest:: group1
- >>> ceil(0.8)
- 1.0
+ >>> trunc(1.1)
+ 1
.. doctest:: group2
- >>> ceil(0.8)
+ >>> trunc(1.1)
Traceback (most recent call last):
...
- NameError: name 'ceil' is not defined
+ NameError: name 'trunc' is not defined
Interleaving testcode/testoutput:
.. testcode:: group1
- print ceil(0.8)
+ print(factorial(3))
.. testcode:: group2
- print floor(0.8)
+ print(factorial(4))
.. testoutput:: group1
- 1.0
+ 6
.. testoutput:: group2
- 0.0
+ 24