I'm getting my function tomato_or_potato()
to fail for testing as in potato check
def potato_check:
if not potato:
raise SpecificError(
message='No potato.',
status_code=409,
)
In my test, I'm trying to assert that SpecificError
was raised:
with assertRaises(Exception) as context:
tomato_or_potato(tomato)
assert SpecificError in context.exception
What I'm getting back tho is always a message 'No potato.' and not the actual SpecificError
.
Aucun commentaire:
Enregistrer un commentaire