Pytest Testing Idioms: Difference between revisions
Jump to navigation
Jump to search
Line 11: | Line 11: | ||
my_method() | my_method() | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<font color=darkkhaki> | |||
How do I ensure a specific type of exception? | |||
</font> |
Revision as of 03:29, 16 February 2022
Internal
Overview
Tested Code is Supposed to Throw Exception
import pytest
def test_something_that_should_throw_exception():
with pytest.raises(Exception) as e_info:
my_method()
How do I ensure a specific type of exception?