with and assertRaises
Checking for expected exceptions in a unit test is made much easier with, with:
with self.assertRaises(StoleniPadException):
clown.useiPad()
Written by Jeff Clark
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Python
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#