I have to test some function with a sample data:
data = [
[[10, 20, 30], 10],
[[20, 30], 20],
[[40], 30],
]
where the first element in each row, lists, contains N=(1 to 5) random integer elements generated via:
st.lists(
st.integers(min_value=10),
min_size=2,
max_size=5,
unique=True)
Second elements in each row contain a random sample from a set of all unique integers from all generated lists.
So for my data
example:
- lists contains values from unique set (10,20,30,40);
- second elements in each row contain a random integer sample from that set;
How do I implement such a strategy with Hypothesis testing framework?
This one does not works:
int_list = st.integers(min_value=10)
@given(st.lists(
elements=st.tuples(
int_list,
st.sampled_from(int_list))