Пример #1
0
def test_containment():
    u, v = find(
        st.tuples(intlist, st.n_byte_unsigned(8)),
        lambda uv: uv[1] in uv[0] and uv[1] >= 100
    )
    assert u == [100]
    assert v == 100
Пример #2
0
def test_minimal_mixed():
    xs = find(
        st.lists(st.booleans() | st.tuples(st.booleans(), st.booleans())),
        lambda x: len(x) >= 10)
    assert xs == [False] * 10
Пример #3
0
def test_non_associative_floats():
    tup = st.tuples(
        st.floats(), st.floats(),
        st.floats()).filter(lambda t: all(math.isfinite(s) for s in t))
    find(tup, lambda x: (x[0] + x[1]) + x[2] != x[0] + (x[1] + x[2]))
Пример #4
0
def test_containment():
    u, v = find(st.tuples(intlist, st.n_byte_unsigned(8)),
                lambda uv: uv[1] in uv[0] and uv[1] >= 100)
    assert u == [100]
    assert v == 100
Пример #5
0
def test_minimal_mixed():
    xs = find(
        st.lists(st.booleans() | st.tuples(st.booleans(), st.booleans())),
        lambda x: len(x) >= 10
    )
    assert xs == [False] * 10
Пример #6
0
def test_non_associative_floats():
    tup = st.tuples(
        st.floats(), st.floats(), st.floats()).filter(
        lambda t: all(math.isfinite(s) for s in t))
    find(tup, lambda x: (x[0] + x[1]) + x[2] != x[0] + (x[1] + x[2]))