summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2004-08-19 06:49:33 (GMT)
committerTim Peters <tim.peters@gmail.com>2004-08-19 06:49:33 (GMT)
commit1cf3aa6e6615dcddc58e42d4fb214f9e0d90d22c (patch)
tree6b9f482fa3db48cdc47ca711991120186ac09a9a /Lib/test
parentcaa9798410887317226c4bf89f38d318b8436612 (diff)
downloadcpython-1cf3aa6e6615dcddc58e42d4fb214f9e0d90d22c.zip
cpython-1cf3aa6e6615dcddc58e42d4fb214f9e0d90d22c.tar.gz
cpython-1cf3aa6e6615dcddc58e42d4fb214f9e0d90d22c.tar.bz2
ELLIPSIS implementation: an ellipsis couldn't match nothing if it
appeared at the end of a line. Repaired that. Also noted that it's too easy to provoke this implementation into requiring exponential time, and especially when a test fails. I'll replace the implementation with an always-efficient one later.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_doctest.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/Lib/test/test_doctest.py b/Lib/test/test_doctest.py
index dec9110..d49e6cf 100644
--- a/Lib/test/test_doctest.py
+++ b/Lib/test/test_doctest.py
@@ -780,6 +780,29 @@ output to match any substring in the actual output:
>>> doctest.DocTestRunner(verbose=False, optionflags=flags).run(test)
(0, 1)
+... should also match nothing gracefully:
+XXX This can be provoked into requiring exponential time by adding more
+XXX ellipses; the implementation should change. It's much easier to
+XXX provoke exponential time with expected output that doesn't match,
+XXX BTW (then multiple regexp .* thingies each try all possiblities,
+XXX multiplicatively, without hope of success). That's the real danger,
+XXX that a failing test will appear to be hung.
+
+ >>> for i in range(100):
+ ... print i**2 #doctest: +ELLIPSIS
+ 0
+ ...
+ 1
+ ...
+ 36
+ ...
+ ...
+ 49
+ 64
+ ......
+ 9801
+ ...
+
The UNIFIED_DIFF flag causes failures that involve multi-line expected
and actual outputs to be displayed using a unified diff: