Custom strategies for hypothesis in python
# custom strategies for hypothesis
# example usage:
#
# @given(garbage)
#
# by: Cody Kochmann
#
from hypothesis import strategies as st
# strategy of lists of strings
lists_with_strings = st.lists(elements=st.text())
# strategy that contains enough garbage to test just about everything
garbage = (
st.binary(),
st.booleans(),
st.characters(),
st.complex_numbers(),
st.decimals(),
st.floats(),
st.fractions(),
st.integers(),
st.none(),
st.random_module(),
st.randoms(),
st.text(),
st.tuples(),
st.uuids()
)
garbage+=(
st.lists(elements=st.one_of(*garbage)),
st.iterables(elements=st.one_of(*garbage))
)
garbage=st.one_of(*garbage)