Exemple #1
0
    def integers_from(x):
        return integers(min_value=x)

    TestManyFlatmaps = strategy_test_suite(
        integers().flatmap(integers_from).flatmap(integers_from).flatmap(
            integers_from).flatmap(integers_from))

    TestIntStreams = strategy_test_suite(streaming(integers()))
    TestStreamLists = strategy_test_suite(streaming(integers()))
    TestIntStreamStreams = strategy_test_suite(streaming(streaming(
        integers())))

    TestBoringBitfieldsClass = strategy_test_suite(basic(BoringBitfields))
    TestBitfieldsClass = strategy_test_suite(basic(Bitfields))
    TestBitfieldsInstance = strategy_test_suite(basic(Bitfields()))

    TestBitfields = strategy_test_suite(
        lists(
            basic(
                generate=lambda r, p: r.getrandbits(128),
                simplify=simplify_bitfield,
                copy=lambda x: x,
            )))

    TestBitfieldsSet = strategy_test_suite(
        sets(
            basic(
                generate=lambda r, p: r.getrandbits(128),
                simplify=simplify_bitfield,
                copy=lambda x: x,
def test_can_use_basic_strategies():
    assert find(ds.basic(Bitfields), lambda x: True) == 0
    assert find(ds.basic(Bitfields()), lambda x: True) == 0
    assert find(ds.basic(BoringBitfields), lambda x: True) != 0
def test_can_override_simplify_in_basic_strategies():
    assert find(ds.basic(BoringBitfields, simplify=Bitfields().simplify),
                lambda x: True) == 0
Exemple #4
0
def test_basic():
    assert isinstance(strategy(Bitfields).example(), integer_types)
    assert isinstance(strategy(Bitfields()).example(), integer_types)