I'm trying to use assertRaisesRegex
(from the unittest module) to ensure that an exception (from our C++ backend) is raised when performing the following assignment:
a[:, 0] = b[:, 0]
a
and b
here are custom types defined in our backend.
In the cases I've seen assertRaisesRegex
used, a function along with its arguments is passed into assertRaisesRegex
, but in this case I need to test that the exception is raised during the above assignment. How can I best do that without having to write an additional function to do the assignment?
Obviously, substitute my
FakeData
with your own actual class, mine is for testing (like a mock).