Reputation: 5618
I just stumbled over this type of code and am bit puzzled by its functionality in unit tests:
with self.assertRaises(MyException):
foo(some_value)
where foo
throws MyException
How does this fit together?
Upvotes: 0
Views: 311
Reputation: 832
This is the test of function foo
that checks whether it raises MyException
or not. The test has positive result if it does, otherwise, it's result is negative.
Upvotes: 1