(self)
| 238 | self.assertEqual(err[1].strip(), "print(2)") |
| 239 | |
| 240 | def test_base_exception(self): |
| 241 | # Test that exceptions derived from BaseException are formatted right |
| 242 | e = KeyboardInterrupt() |
| 243 | lst = traceback.format_exception_only(e.__class__, e) |
| 244 | self.assertEqual(lst, ['KeyboardInterrupt\n']) |
| 245 | |
| 246 | def test_format_exception_only_bad__str__(self): |
| 247 | class X(Exception): |
nothing calls this directly
no test coverage detected