Skip to content

Commit 84dbaee

Browse files
committed
enforce no-zero-weights
1 parent bf31b5e commit 84dbaee

File tree

1 file changed

+3
-0
lines changed
  • hypothesis-python/src/hypothesis/internal/conjecture

1 file changed

+3
-0
lines changed

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

+3
Original file line numberDiff line numberDiff line change
@@ -2139,6 +2139,9 @@ def draw_integer(
21392139
# complicates shrinking as we can no longer assume we can force
21402140
# a value to the unmapped probability mass if that mass might be 0.
21412141
assert sum(weights.values()) < 1
2142+
# similarly, things get simpler if we assume every value is possible.
2143+
# we'll want to drop this restriction eventually.
2144+
assert all(w != 0 for w in weights.values())
21422145

21432146
if forced is not None and (min_value is None or max_value is None):
21442147
# We draw `forced=forced - shrink_towards` here internally, after clamping.

0 commit comments

Comments
 (0)