From 5612e561a96f4da735e966f527e1e01265564ae1 Mon Sep 17 00:00:00 2001 From: Pablo Galindo Date: Wed, 30 Nov 2022 11:22:49 +0000 Subject: [PATCH 1/4] gh-99894: Ensure the local names don't collide with the test file in traceback suggestion error checking --- Lib/test/test_traceback.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_traceback.py b/Lib/test/test_traceback.py index c17bbb48b65b2d..655470fec95639 100644 --- a/Lib/test/test_traceback.py +++ b/Lib/test/test_traceback.py @@ -2979,8 +2979,8 @@ class MyClass: with self.subTest(name=name): actual = self.get_suggestion(MyClass, name) self.assertNotIn("you mean", actual) - self.assertNotIn("vvv", actual) - self.assertNotIn("mom", actual) + self.assertNotIn("'vvv'", actual) + self.assertNotIn("'mom'", actual) self.assertNotIn("'id'", actual) self.assertNotIn("'w'", actual) self.assertNotIn("'pytho'", actual) From d159ac5d56377fff3be5e70c8ffb4b508a4a26d5 Mon Sep 17 00:00:00 2001 From: Pablo Galindo Date: Wed, 30 Nov 2022 11:41:58 +0000 Subject: [PATCH 2/4] fixup! gh-99894: Ensure the local names don't collide with the test file in traceback suggestion error checking --- Lib/test/test_traceback.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Lib/test/test_traceback.py b/Lib/test/test_traceback.py index 655470fec95639..f28bbf62f605f7 100644 --- a/Lib/test/test_traceback.py +++ b/Lib/test/test_traceback.py @@ -2979,7 +2979,7 @@ class MyClass: with self.subTest(name=name): actual = self.get_suggestion(MyClass, name) self.assertNotIn("you mean", actual) - self.assertNotIn("'vvv'", actual) + self.assertNotIn("'vvv", actual) self.assertNotIn("'mom'", actual) self.assertNotIn("'id'", actual) self.assertNotIn("'w'", actual) @@ -3169,8 +3169,8 @@ def test_import_from_error_bad_suggestions_do_not_trigger_for_small_names(self): with self.subTest(name=name): actual = self.get_import_from_suggestion(code, name) self.assertNotIn("you mean", actual) - self.assertNotIn("vvv", actual) - self.assertNotIn("mom", actual) + self.assertNotIn("'vvv'", actual) + self.assertNotIn("'mom'", actual) self.assertNotIn("'id'", actual) self.assertNotIn("'w'", actual) self.assertNotIn("'pytho'", actual) From 2287142a8d122d289bf0b67b9ab6ff602d64f76c Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 30 Nov 2022 16:54:34 +0100 Subject: [PATCH 3/4] Update Lib/test/test_traceback.py --- Lib/test/test_traceback.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_traceback.py b/Lib/test/test_traceback.py index f28bbf62f605f7..041ccaa4a95aa9 100644 --- a/Lib/test/test_traceback.py +++ b/Lib/test/test_traceback.py @@ -2978,7 +2978,7 @@ class MyClass: for name in ("b", "v", "m", "py"): with self.subTest(name=name): actual = self.get_suggestion(MyClass, name) - self.assertNotIn("you mean", actual) + self.assertNotIn("Did you mean", actual) self.assertNotIn("'vvv", actual) self.assertNotIn("'mom'", actual) self.assertNotIn("'id'", actual) From 227b315b690b14d12524b42f76a344331915eca1 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 30 Nov 2022 16:54:39 +0100 Subject: [PATCH 4/4] Update Lib/test/test_traceback.py --- Lib/test/test_traceback.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_traceback.py b/Lib/test/test_traceback.py index 041ccaa4a95aa9..95b1bae4f60850 100644 --- a/Lib/test/test_traceback.py +++ b/Lib/test/test_traceback.py @@ -3168,7 +3168,7 @@ def test_import_from_error_bad_suggestions_do_not_trigger_for_small_names(self): for name in ("b", "v", "m", "py"): with self.subTest(name=name): actual = self.get_import_from_suggestion(code, name) - self.assertNotIn("you mean", actual) + self.assertNotIn("Did you mean", actual) self.assertNotIn("'vvv'", actual) self.assertNotIn("'mom'", actual) self.assertNotIn("'id'", actual)