def assert_all_examples(strategy, predicate):
'''
Checks that there are no examples with given strategy
that do not match predicate.
:param strategy: Hypothesis strategy to check
:param predicate: (callable) Predicate that takes string example and returns bool
'''
@h.settings(max_examples=1000, max_iterations=5000)
@h.given(strategy)
def assert_examples(s):
assert predicate(s),'Found %r using strategy %s which does not match' % (
s, strategy,
)
assert_examples()
评论列表
文章目录