Skip to content

Commit 4e60566

Browse files
authored
bpo-45400: Fix suggestion test of test_exceptions (GH-28783)
Fix test_name_error_suggestions_do_not_trigger_for_too_many_locals() of test_exceptions if a directory name contains "a1" (like "Python-3.11.0a1"): use a stricter regular expression.
1 parent 3f2c433 commit 4e60566

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

Lib/test/test_exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1840,7 +1840,7 @@ def f():
18401840
with support.captured_stderr() as err:
18411841
sys.__excepthook__(*sys.exc_info())
18421842

1843-
self.assertNotIn("a1", err.getvalue())
1843+
self.assertNotRegex(err.getvalue(), r"NameError.*a1")
18441844

18451845
def test_name_error_with_custom_exceptions(self):
18461846
def f():
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Fix test_name_error_suggestions_do_not_trigger_for_too_many_locals() of
2+
test_exceptions if a directory name contains "a1" (like "Python-3.11.0a1"):
3+
use a stricter regular expression. Patch by Victor Stinner.

0 commit comments

Comments
 (0)