Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ea4f931

Browse files
committed
Teach doctest about newer "(most recent call last)" traceback spelling.
1 parent 467d723 commit ea4f931

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

Lib/doctest.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def _test():
160160
traceback itself. For example:
161161
162162
>>> 1/0
163-
Traceback (innermost last):
163+
Traceback (most recent call last):
164164
File "<stdin>", line 1, in ?
165165
ZeroDivisionError: integer division or modulo by zero
166166
>>>
@@ -246,7 +246,7 @@ def _test():
246246
Running doctest.__doc__
247247
Trying: 1/0
248248
Expecting:
249-
Traceback (innermost last):
249+
Traceback (most recent call last):
250250
File "<stdin>", line 1, in ?
251251
ZeroDivisionError: integer division or modulo by zero
252252
ok
@@ -489,7 +489,8 @@ def _run_examples_inner(out, fakeout, examples, globs, verbose, name):
489489
state = OK
490490
except:
491491
# See whether the exception was expected.
492-
if want.find("Traceback (innermost last):\n") == 0:
492+
if want.find("Traceback (innermost last):\n") == 0 or \
493+
want.find("Traceback (most recent call last):\n") == 0:
493494
# Only compare exception type and value - the rest of
494495
# the traceback isn't necessary.
495496
want = want.split('\n')[-2] + '\n'

Lib/test/output/test_doctest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ test_doctest
22
Running doctest.__doc__
33
Trying: 1/0
44
Expecting:
5-
Traceback (innermost last):
5+
Traceback (most recent call last):
66
File "<stdin>", line 1, in ?
77
ZeroDivisionError: integer division or modulo by zero
88
ok

0 commit comments

Comments
 (0)