Answers for "unittest assert raises context manager"

1

unittest assert raises context manager

with self.assertRaises(SomeException) as cm:
    do_something()

the_exception = cm.exception
self.assertEqual(the_exception.error_code, 3)
Posted by: Guest on December-16-2020

Browse Popular Code Answers by Language