Skip to content

Commit aab0141

Browse files
authored
Merge pull request #4284 from Zac-HD/test-on-39
Get test working on older Python
2 parents 7a47052 + 3577be3 commit aab0141

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

hypothesis-python/tests/nocover/test_conjecture_utils.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ def test_sampler_matches_distribution(weights, random):
3535
# if we ever pull in scipy to our test suite, we should do a chi squared
3636
# test here instead.
3737
expected = [w / sum(weights) for w in weights]
38-
actual = [counter[i] / counter.total() for i in range(len(weights))]
38+
counter_total = sum(counter.values()) # Counter.total() new in py3.10
39+
actual = [counter[i] / counter_total for i in range(len(weights))]
3940
for p1, p2 in zip(expected, actual):
4041
assert abs(p1 - p2) < 0.05, (expected, actual)
4142

0 commit comments

Comments
 (0)