From 5598bdf76fc5ca65023757ca72d85f2741350b5a Mon Sep 17 00:00:00 2001 From: bengartner Date: Sun, 22 Jun 2025 10:24:28 -0500 Subject: [PATCH] Self-test: fix test_doctest_unexpected_exception in Python 3.14 (#13548) Fixes #13547. (cherry picked from commit 48be3c8bce38bc950dba82747d3ecf451a3f45c8) --- changelog/13547.contrib.rst | 1 + testing/test_doctest.py | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 changelog/13547.contrib.rst diff --git a/changelog/13547.contrib.rst b/changelog/13547.contrib.rst new file mode 100644 index 00000000000..d8a240c0506 --- /dev/null +++ b/changelog/13547.contrib.rst @@ -0,0 +1 @@ +Self-testing: corrected expected message for ``test_doctest_unexpected_exception`` in Python ``3.14``. diff --git a/testing/test_doctest.py b/testing/test_doctest.py index 1a852ebc82a..f4ed976c839 100644 --- a/testing/test_doctest.py +++ b/testing/test_doctest.py @@ -223,9 +223,12 @@ def test_doctest_unexpected_exception(self, pytester: Pytester): "002 >>> 0 / i", "UNEXPECTED EXCEPTION: ZeroDivisionError*", "Traceback (most recent call last):", - ' File "*/doctest.py", line *, in __run', - " *", - *((" *^^^^*", " *", " *") if sys.version_info >= (3, 13) else ()), + *( + (' File "*/doctest.py", line *, in __run', " *") + if sys.version_info <= (3, 14) + else () + ), + *((" *^^^^*", " *", " *") if sys.version_info[:2] == (3, 13) else ()), ' File "", line 1, in ', "ZeroDivisionError: division by zero", "*/test_doctest_unexpected_exception.txt:2: UnexpectedException",