def test_when_above_the_limit_there_is_an_error(
self, limit_cls_and_name, limit, value):
limit_cls, name = limit_cls_and_name
assert limit < value, 'test pre-req'
limit_obj = limit_cls(**{name: limit})
result = NameValueResult(name, value)
with pytest.raises(LimitViolationError) as excinfo:
limit_obj.handle_results(
results=[result], context=None)
assert excinfo.value.limit_obj == limit_obj
assert excinfo.value.result == result
assert excinfo.value.actual == str(value)
assert not excinfo.value.context
test_core_infrastructure.py 文件源码
python
阅读 24
收藏 0
点赞 0
评论 0
评论列表
文章目录