Skip to content

Commit f2a1064

Browse files
one change
1 parent e4734b0 commit f2a1064

File tree

2 files changed

+254
-579
lines changed

2 files changed

+254
-579
lines changed

Lib/test/test_traceback.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2495,7 +2495,9 @@ def __repr__(self):
24952495
# unprintable, non-string item in the __notes__ sequence
24962496
e.__notes__ = [Unprintable(), 'Final Note']
24972497
err_msg = '<note str() failed>'
2498-
self.assertEqual(self.get_report(e), vanilla + err_msg + '\nFinal Note\n')
2498+
msg = self.get_report(e)
2499+
self.assertIn(vanilla + err_msg + '\nFinal Note\n', msg)
2500+
self.assertIn("Exception ignored in note str():", msg)
24992501

25002502
e.__notes__ = "please do not explode me"
25012503
err_msg = "'please do not explode me'"
@@ -4231,8 +4233,14 @@ def __getattr__(self, attr):
42314233
raise AttributeError(23)
42324234

42334235
for cls in [A, B, C]:
4234-
actual = self.get_suggestion(cls(), 'bluch')
4235-
self.assertIn("blech", actual)
4236+
try:
4237+
getattr(cls(), "bluch")
4238+
except AttributeError:
4239+
msg = traceback.format_exc()
4240+
self.assertIn("blech", msg)
4241+
# actual = self.get_suggestion(cls(), 'bluch')
4242+
# self.assertIn("blech", actual)
4243+
# The above using is changed because it will get the warning in the ignore exception
42364244

42374245

42384246
class DelattrSuggestionTests(BaseSuggestionTests):

0 commit comments

Comments
 (0)