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

Skip to content

Commit 60e23f4

Browse files
committed
Change doctest exception example to one whose detail hasn't changed since 1.5.2.
1 parent 0eea166 commit 60e23f4

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

Lib/doctest.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,10 @@ def _test():
159159
No problem, as long as the only output generated by the example is the
160160
traceback itself. For example:
161161
162-
>>> 1/0
162+
>>> [1, 2, 3].remove(42)
163163
Traceback (most recent call last):
164164
File "<stdin>", line 1, in ?
165-
ZeroDivisionError: integer division or modulo by zero
165+
ValueError: list.remove(x): x not in list
166166
>>>
167167
168168
Note that only the exception type and value are compared (specifically,
@@ -244,11 +244,11 @@ def _test():
244244
executed, leading to this output in verbose mode:
245245
246246
Running doctest.__doc__
247-
Trying: 1/0
247+
Trying: [1, 2, 3].remove(42)
248248
Expecting:
249249
Traceback (most recent call last):
250250
File "<stdin>", line 1, in ?
251-
ZeroDivisionError: integer division or modulo by zero
251+
ValueError: list.remove(x): x not in list
252252
ok
253253
Trying: x = 12
254254
Expecting: nothing

Lib/test/output/test_doctest

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
test_doctest
22
Running doctest.__doc__
3-
Trying: 1/0
3+
Trying: [1, 2, 3].remove(42)
44
Expecting:
55
Traceback (most recent call last):
66
File "<stdin>", line 1, in ?
7-
ZeroDivisionError: integer division or modulo by zero
7+
ValueError: list.remove(x): x not in list
88
ok
99
Trying: x = 12
1010
Expecting: nothing

0 commit comments

Comments
 (0)