Skip to content

Commit 116bbd3

Browse files
committed
also force in the idx case to ensure good shrinks
not writing the idx case to the bytestream could result in the idx != 0 case being much bytestream-simpler but not ir-simpler
1 parent 5b3e33e commit 116bbd3

File tree

1 file changed

+6
-10
lines changed
  • hypothesis-python/src/hypothesis/internal/conjecture

1 file changed

+6
-10
lines changed

hypothesis-python/src/hypothesis/internal/conjecture/data.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1491,17 +1491,13 @@ def draw_integer(
14911491
self._cd, forced=None if forced is None else 0, fake_forced=fake_forced
14921492
)
14931493

1494-
return (
1495-
self._draw_bounded_integer(
1496-
min_value,
1497-
max_value,
1498-
forced=forced,
1499-
center=shrink_towards,
1500-
fake_forced=fake_forced,
1501-
)
1502-
if idx == 0
1494+
return self._draw_bounded_integer(
1495+
min_value,
1496+
max_value,
15031497
# implicit reliance on dicts being sorted for determinism
1504-
else list(weights)[idx - 1]
1498+
forced=forced if idx == 0 else list(weights)[idx - 1],
1499+
center=shrink_towards,
1500+
fake_forced=fake_forced,
15051501
)
15061502

15071503
if min_value is None and max_value is None:

0 commit comments

Comments
 (0)