Slide 40
Slide 40 text
SURE: WRITE FLUENT ASSERTIONS
Exceptions
def get_deal_by_id(id):
return Deal.objects.get(id=id)
Code:
assert that(get_deal_by_id, with_args=(5,)).raises(Deal.DoesNotExist)
Sure:
get_deal_by_id.when.called_with(5).should.throw(
Deal.DoesNotExist,
"Deal with id 5 does not exist",
)
or