def test_can_produce_different_results(rnd, ls): assume(len(set(bisect_left(ls, i) for i in ls)) > 1) seen = set() for _ in range(100): x = schroedinteger(ls) seen.add(bisect_left(ls, x)) if len(seen) > 1: return assert False
from hypothesis import strategies as st from schroedinteger import schroedinteger schroedintegers = st.builds( lambda x, _: schroedinteger(x), st.lists(st.integers(), min_size=1, average_size=5), st.random_module() ) mixed_integers = schroedintegers | st.integers()
from hypothesis import strategies as st from schroedinteger import schroedinteger schroedintegers = st.builds( lambda x, _: schroedinteger(x), st.lists(st.integers(), min_size=1, average_size=5), st.random_module()) mixed_integers = schroedintegers | st.integers()
def test_schroedinteger_is_int(): x = schroedinteger([1, 2, 3]) assert isinstance(x, int) assert type(x) != int
def test_has_same_methods(): x = 1 y = schroedinteger([1, 2]) for v in dir(x): assert hasattr(y, v)
def test_int_schroedinteger_is_really_int(): x = schroedinteger([1, 2, 3]) assert type(int(x)) == int