def test_function_exception(self): y = foo.my_inverse_func(2) self.assertEqual(y, 0.5) self.assertRaises(foo.DomainError, foo.my_inverse_func, 0)