From 92b73e0f3db76c4f7251f9703a306846e7dc4462 Mon Sep 17 00:00:00 2001 From: Jerry James Date: Tue, 23 Jul 2024 09:44:34 -0600 Subject: [PATCH] Fix test_format_exception_as_html on python 3.13 --- src/zope/exceptions/tests/test_exceptionformatter.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/zope/exceptions/tests/test_exceptionformatter.py b/src/zope/exceptions/tests/test_exceptionformatter.py index 92ea79a..1a37538 100644 --- a/src/zope/exceptions/tests/test_exceptionformatter.py +++ b/src/zope/exceptions/tests/test_exceptionformatter.py @@ -24,6 +24,7 @@ from urllib.error import HTTPError IS_PY39_OR_GREATER = sys.version_info >= (3, 9) +IS_PY313_OR_GREATER = sys.version_info >= (3, 13) class TextExceptionFormatterTests(unittest.TestCase): @@ -772,6 +773,9 @@ class Test_format_exception(unittest.TestCase): # Python 3.9 moves the pointer after the statement instead to the # last character of it: expected = expected.replace('^
', ' ^
') + if IS_PY313_OR_GREATER: # pragma: no cover + # Python 3.13 changed the text of the SyntaxError + expected = expected.replace("invalid syntax", "Expected one or more names after 'import'") # HTML formatter uses Windows line endings for some reason. result = result.replace('\r\n', '\n') result = re.sub(r'line \d\d\d,', 'line ABC,', result) -- 2.45.2