bpo-38530: Cover more error paths in error suggestion functions (GH-25462)

This commit is contained in:
Pablo Galindo 2021-04-17 23:28:45 +01:00 committed by GitHub
parent 8bf274a500
commit 0b1c169c4a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 2 deletions

View file

@ -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):