diff options
author | Tim Peters <tim.peters@gmail.com> | 2004-08-19 08:10:08 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2004-08-19 08:10:08 (GMT) |
commit | 26b3ebb515eacb997885ff4fe1b425674429e253 (patch) | |
tree | b8c937c492db93256726cb43df70afa8c45fc93b /Lib/test/test_doctest.py | |
parent | 1cf3aa6e6615dcddc58e42d4fb214f9e0d90d22c (diff) | |
download | cpython-26b3ebb515eacb997885ff4fe1b425674429e253.zip cpython-26b3ebb515eacb997885ff4fe1b425674429e253.tar.gz cpython-26b3ebb515eacb997885ff4fe1b425674429e253.tar.bz2 |
Replaced the ELLIPSIS implementation with a worst-case linear-time one.
Diffstat (limited to 'Lib/test/test_doctest.py')
-rw-r--r-- | Lib/test/test_doctest.py | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/Lib/test/test_doctest.py b/Lib/test/test_doctest.py index d49e6cf..e96fd2a 100644 --- a/Lib/test/test_doctest.py +++ b/Lib/test/test_doctest.py @@ -780,13 +780,8 @@ 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. +... should also match nothing gracefully (note that a regular-expression +implementation of ELLIPSIS would take a loooong time to match this one!): >>> for i in range(100): ... print i**2 #doctest: +ELLIPSIS @@ -794,15 +789,32 @@ XXX that a failing test will appear to be hung. ... 1 ... + ...... + ... 36 ... ... + ... 49 64 - ...... + ......... 9801 ... +... can be surprising; e.g., this test passes: + + >>> for i in range(21): #doctest: +ELLIPSIS + ... print i + 0 + 1 + 2 + ... + 1 + ... + 2 + ... + 0 + The UNIFIED_DIFF flag causes failures that involve multi-line expected and actual outputs to be displayed using a unified diff: |