This question already has an answer here:
Being quite new to exception test handling I am wondering how to check if an assertion is raised.
a.py
class SomeError(Exception):
pass
class SomeClass(object):
def __init__(self):
...
raise SomeError
...
test_a.py
from a.a import SomeClass
def test_some_exception_raised():
?
What assertion should it be there to check if SomeError
is raised? I am using pytest.
Aucun commentaire:
Enregistrer un commentaire