Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add test_note in test_exceptions
  • Loading branch information
iritkatriel committed Dec 1, 2021
commit 2f380bf448d8d250fd3649a11f59092af40d0329
13 changes: 13 additions & 0 deletions Lib/test/test_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,19 @@ def testAttributes(self):
'pickled "%r", attribute "%s' %
(e, checkArgName))

def test_note(self):
for e in [BaseException(1), Exception(2), ValueError(3)]:
with self.subTest(e=e):
self.assertIsNone(e.__note__)
e.__note__ = "My Note"
self.assertEqual(e.__note__, "My Note")

with self.assertRaises(TypeError):
e.__note__ = 42

e.__note__ = None
self.assertIsNone(e.__note__)

def testWithTraceback(self):
try:
raise IndexError(4)
Expand Down