I wrote a test to verify a given function behaves correctly for any given permutation of a list specified as input.
Using the hypothesis
python package I've tried to construct this test case. However, the list of permutations generated contains many duplicate test cases.
For instance, using a list of 3 items (['a', 'b', 'c']
) I would expect 6 entries in the list of permutations (abc, acb, bac, bca, cab, cba), but this is not the case.
Here's a MWE, assuming you have the hypothesis package:
from hypothesis import given
from hypothesis.strategies import permutations
@given(permutations(['a', 'b', 'c']))
def test(permutation):
print(permutation)
test()
Alternatively, the code is live on repl.it.
The documentation unfortunately didn't enlighten me, but maybe I'm not looking in the right place.
Any idea on what I'm doing wrong?