📅  最后修改于: 2022-03-11 14:57:33.330000             🧑  作者: Mango
with self.assertRaises(SomeException) as cm:
do_something()
the_exception = cm.exception
self.assertEqual(the_exception.error_code, 3)