You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
E hypothesis.errors.InvalidArgument: Cannot sample from a length-zero sequence.
E Falsifying example: test_sample_from_empty(
E rnd=HypothesisRandom(generated data),
E )
But the following test passes:
from random import Random
def test_sample_from_empty():
rnd = Random()
assert rnd.sample([], 0) == []
The issue is that although you can't sample a non-zero number of elements from an empty sequence, it's perfectly valid to sample 0 elements from an empty sequence, and the normal Random class supports this fine but our emulation of it does not.
The text was updated successfully, but these errors were encountered:
The following code doesn't work correctly when using Hypothesis's fake random number generator:
It fails with:
But the following test passes:
The issue is that although you can't sample a non-zero number of elements from an empty sequence, it's perfectly valid to sample 0 elements from an empty sequence, and the normal Random class supports this fine but our emulation of it does not.
The text was updated successfully, but these errors were encountered: