本文整理汇总了Python中hypothesis.internal.conjecture.engine.ConjectureRunner.prescreen_buffer方法的典型用法代码示例。如果您正苦于以下问题:Python ConjectureRunner.prescreen_buffer方法的具体用法?Python ConjectureRunner.prescreen_buffer怎么用?Python ConjectureRunner.prescreen_buffer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hypothesis.internal.conjecture.engine.ConjectureRunner
的用法示例。
在下文中一共展示了ConjectureRunner.prescreen_buffer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_detects_too_small_block_starts
# 需要导入模块: from hypothesis.internal.conjecture.engine import ConjectureRunner [as 别名]
# 或者: from hypothesis.internal.conjecture.engine.ConjectureRunner import prescreen_buffer [as 别名]
def test_detects_too_small_block_starts():
def f(data):
data.draw_bytes(8)
data.mark_interesting()
runner = ConjectureRunner(f, settings=settings(database=None))
r = ConjectureData.for_buffer(hbytes(8))
runner.test_function(r)
assert r.status == Status.INTERESTING
assert not runner.prescreen_buffer(hbytes([255] * 7))
示例2: test_prescreen_with_masked_byte_agrees_with_results
# 需要导入模块: from hypothesis.internal.conjecture.engine import ConjectureRunner [as 别名]
# 或者: from hypothesis.internal.conjecture.engine.ConjectureRunner import prescreen_buffer [as 别名]
def test_prescreen_with_masked_byte_agrees_with_results(byte_a, byte_b):
def f(data):
data.draw_bits(2)
runner = ConjectureRunner(f)
data_a = ConjectureData.for_buffer(hbytes([byte_a]))
data_b = ConjectureData.for_buffer(hbytes([byte_b]))
runner.test_function(data_a)
prescreen_b = runner.prescreen_buffer(hbytes([byte_b]))
# Always test buffer B, to check whether the prescreen was correct.
runner.test_function(data_b)
# If the prescreen passed, then the buffers should be different.
# If it failed, then the buffers should be the same.
assert prescreen_b == (data_a.buffer != data_b.buffer)