Skip to content

Commit 282edb1

Browse files
committed
add covering case for newly missing coverage
1 parent 9307192 commit 282edb1

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

hypothesis-python/tests/conjecture/test_shrinker.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
from hypothesis.internal.conjecture.utils import Sampler
2727
from hypothesis.internal.floats import MAX_PRECISE_INTEGER
2828

29+
from tests.common.debug import minimal
2930
from tests.conjecture.common import (
3031
SOME_LABEL,
3132
float_kw,
@@ -655,3 +656,15 @@ def shrinker(data: ConjectureData):
655656

656657
shrinker.fixate_shrink_passes(["lower_duplicated_characters"])
657658
assert shrinker.choices == (expected[0],) + (0,) * gap + (expected[1],)
659+
660+
661+
def test_shrinking_one_of_with_same_shape():
662+
# This is a covering test for our one_of shrinking logic for the case when
663+
# the choice sequence *doesn't* change shape in the newly chosen one_of branch.
664+
#
665+
# There are relatively few tests in our suite that cover this (and previously
666+
# none in the covering subset). I chose the simplest one to copy here, but
667+
# haven't yet put time into extracting the essence of a test case that
668+
# covers this case, which is why we're using st.permutations here instead of
669+
# something more fundamental / obviously testing what we want.
670+
minimal(st.permutations(list(range(5))), lambda x: x[0] != 0)

0 commit comments

Comments
 (0)