(self)
| 607 | e.__setstate__(42) |
| 608 | |
| 609 | def test_notes(self): |
| 610 | for e in [BaseException(1), Exception(2), ValueError(3)]: |
| 611 | with self.subTest(e=e): |
| 612 | self.assertNotHasAttr(e, '__notes__') |
| 613 | e.add_note("My Note") |
| 614 | self.assertEqual(e.__notes__, ["My Note"]) |
| 615 | |
| 616 | with self.assertRaises(TypeError): |
| 617 | e.add_note(42) |
| 618 | self.assertEqual(e.__notes__, ["My Note"]) |
| 619 | |
| 620 | e.add_note("Your Note") |
| 621 | self.assertEqual(e.__notes__, ["My Note", "Your Note"]) |
| 622 | |
| 623 | del e.__notes__ |
| 624 | self.assertNotHasAttr(e, '__notes__') |
| 625 | |
| 626 | e.add_note("Our Note") |
| 627 | self.assertEqual(e.__notes__, ["Our Note"]) |
| 628 | |
| 629 | e.__notes__ = 42 |
| 630 | self.assertEqual(e.__notes__, 42) |
| 631 | |
| 632 | with self.assertRaises(TypeError): |
| 633 | e.add_note("will not work") |
| 634 | self.assertEqual(e.__notes__, 42) |
| 635 | |
| 636 | def testWithTraceback(self): |
| 637 | try: |
nothing calls this directly
no test coverage detected