summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_doctest.py
diff options
context:
space:
mode:
authorEdward Loper <edloper@gradient.cis.upenn.edu>2004-08-12 02:34:27 (GMT)
committerEdward Loper <edloper@gradient.cis.upenn.edu>2004-08-12 02:34:27 (GMT)
commit8e4a34ba090a4ad9753ea8d9ccf95703c85fdbb4 (patch)
tree376bc708032ff21cf85bff23a1bf9f82a7254c14 /Lib/test/test_doctest.py
parent74bca7aa44be315c669edcc0e02126fdd927062b (diff)
downloadcpython-8e4a34ba090a4ad9753ea8d9ccf95703c85fdbb4.zip
cpython-8e4a34ba090a4ad9753ea8d9ccf95703c85fdbb4.tar.gz
cpython-8e4a34ba090a4ad9753ea8d9ccf95703c85fdbb4.tar.bz2
- Added __docformat__
- Added comments for some regexps - If the traceback type/message don't match, then still print full traceback in report_failure (not just the first & last lines) - Renamed DocTestRunner.__failure_header -> _failure_header
Diffstat (limited to 'Lib/test/test_doctest.py')
-rw-r--r--Lib/test/test_doctest.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/Lib/test/test_doctest.py b/Lib/test/test_doctest.py
index 977ade7..c734cae 100644
--- a/Lib/test/test_doctest.py
+++ b/Lib/test/test_doctest.py
@@ -269,10 +269,10 @@ will return a single test (for that function's docstring):
>>> finder = doctest.DocTestFinder()
>>> tests = finder.find(sample_func)
-
+
>>> print tests # doctest: +ELLIPSIS
[<DocTest sample_func from ...:12 (1 example)>]
-
+
>>> e = tests[0].examples[0]
>>> (e.source, e.want, e.lineno)
('print sample_func(22)\n', '44\n', 3)
@@ -620,6 +620,7 @@ message is raised, then it is reported as a failure:
... '''
>>> test = doctest.DocTestFinder().find(f)[0]
>>> doctest.DocTestRunner(verbose=False).run(test)
+ ... # doctest: +ELLIPSIS
**********************************************************************
Failure in example: raise ValueError, 'message'
from line #1 of f
@@ -628,6 +629,7 @@ message is raised, then it is reported as a failure:
ValueError: wrong message
Got:
Traceback (most recent call last):
+ ...
ValueError: message
(1, 1)
@@ -897,7 +899,7 @@ comment of the form ``# doctest: -OPTION``:
Option directives affect only the example that they appear with; they
do not change the options for surrounding examples:
-
+
>>> def f(x): r'''
... >>> print range(10) # Should fail: no ellipsis
... [0, 1, ..., 9]
@@ -984,7 +986,7 @@ long as a continuation prompt is used:
>>> test = doctest.DocTestFinder().find(f)[0]
>>> doctest.DocTestRunner(verbose=False).run(test)
(0, 1)
-
+
For examples with multi-line source, the option directive may appear
at the end of any line: