How To’s and Code Samples
Python 3 Exceptions in Unit Tests
Python 3 introduces the ability to verify exceptions were raised in unit tests without having to introduce additional exception handling code. A context manager is utilized to provide this capability.
...UNIT TEST CODE... with self.assertRaises(ExceptionType): function_that_raises_exception() ...MORE UNIT TEST CODE...