How does one write a unit test that fails only if a function doesn't throw an expected exception?
Python Exception Testing – How to Test if a Function Throws an Exception
exceptionpythonunit-testing
exceptionpythonunit-testing
How does one write a unit test that fails only if a function doesn't throw an expected exception?
Best Answer
Use
TestCase.assertRaises
from theunittest
module, for example: