For a unit test, I would like to generate a list
of float
using the hypothesis
library. There are some important constraints:
- The number of constituents within the list must be greater than 1 and less than 15
- The minimum value must be greater than 0
- The maximum value must be less than 1
- The sum of all constituents must exactly equal one (1)
So far, I was able to satisfy the first three constraints.
@given(
strategies.lists(
st.floats(min_value=0, max_value=1, exclude_min=True, exclude_max=True),
min_size=2,
max_size=15,
)
)
How can I satisfy the fourth constraint?