当前位置: 首页>>代码示例>>Python>>正文


Python ConjectureRunner.prescreen_buffer方法代码示例

本文整理汇总了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))
开发者ID:Wilfred,项目名称:hypothesis-python,代码行数:11,代码来源:test_conjecture_engine.py

示例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)
开发者ID:Wilfred,项目名称:hypothesis-python,代码行数:19,代码来源:test_conjecture_engine.py


注:本文中的hypothesis.internal.conjecture.engine.ConjectureRunner.prescreen_buffer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。