Skip to content

Commit 5bc2f47

Browse files
Self-test: fix test_doctest_unexpected_exception in Python 3.14 (#13548) (#13552)
Fixes #13547. (cherry picked from commit 48be3c8) Co-authored-by: bengartner <[email protected]>
1 parent 240454f commit 5bc2f47

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

changelog/13547.contrib.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Self-testing: corrected expected message for ``test_doctest_unexpected_exception`` in Python ``3.14``.

testing/test_doctest.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,12 @@ def test_doctest_unexpected_exception(self, pytester: Pytester):
223223
"002 >>> 0 / i",
224224
"UNEXPECTED EXCEPTION: ZeroDivisionError*",
225225
"Traceback (most recent call last):",
226-
' File "*/doctest.py", line *, in __run',
227-
" *",
228-
*((" *^^^^*", " *", " *") if sys.version_info >= (3, 13) else ()),
226+
*(
227+
(' File "*/doctest.py", line *, in __run', " *")
228+
if sys.version_info <= (3, 14)
229+
else ()
230+
),
231+
*((" *^^^^*", " *", " *") if sys.version_info[:2] == (3, 13) else ()),
229232
' File "<doctest test_doctest_unexpected_exception.txt[1]>", line 1, in <module>',
230233
"ZeroDivisionError: division by zero",
231234
"*/test_doctest_unexpected_exception.txt:2: UnexpectedException",

0 commit comments

Comments
 (0)