Skip to content

Instantly share code, notes, and snippets.

@NMZivkovic
Created March 9, 2019 17:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NMZivkovic/84b86fedec4d9af0e72a6c76c08a6dc2 to your computer and use it in GitHub Desktop.
Save NMZivkovic/84b86fedec4d9af0e72a6c76c08a6dc2 to your computer and use it in GitHub Desktop.
def test_exception(self):
m = mock.Mock()
m.thow_exception.side_effect = RuntimeError('Oh no!')
try:
m.thow_exception()
except RuntimeError:
assert True
else:
assert False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment