From 0b1c169c4a009e1094fe5df938d2367e63ebeea0 Mon Sep 17 00:00:00 2001 From: Pablo Galindo Date: Sat, 17 Apr 2021 23:28:45 +0100 Subject: bpo-38530: Cover more error paths in error suggestion functions (GH-25462) --- Lib/test/test_exceptions.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'Lib/test/test_exceptions.py') diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py index b730858a997..d1e1b196c42 100644 --- a/Lib/test/test_exceptions.py +++ b/Lib/test/test_exceptions.py @@ -1741,6 +1741,16 @@ class AttributeErrorTests(unittest.TestCase): self.assertNotIn("blech", err.getvalue()) self.assertNotIn("oh no!", err.getvalue()) + def test_attribute_error_with_bad_name(self): + try: + raise AttributeError(name=12, obj=23) + except AttributeError as exc: + with support.captured_stderr() as err: + sys.__excepthook__(*sys.exc_info()) + + self.assertNotIn("?", err.getvalue()) + + class ImportErrorTests(unittest.TestCase): def test_attributes(self): -- cgit v1.2.3