Commit ea4142b 2 people authored and committed
1 parent e1630fb commit ea4142b Copy full SHA for ea4142b
File tree 2 files changed +8
-2
lines changed
2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change
1
+ * fixed spurious ` test_double ` failures.
Original file line number Diff line number Diff line change 3
3
4
4
from pyo3_pytests import othermod
5
5
6
- INTEGER32_ST = st .integers (min_value = (- (2 ** 31 )), max_value = (2 ** 31 - 1 ))
6
+ INTEGER31_ST = st .integers (min_value = (- (2 ** 30 )), max_value = (2 ** 30 - 1 ))
7
7
USIZE_ST = st .integers (min_value = othermod .USIZE_MIN , max_value = othermod .USIZE_MAX )
8
8
9
9
10
- @given (x = INTEGER32_ST )
10
+ # If the full 32 bits are used here, then you can get failures that look like this:
11
+ # hypothesis.errors.FailedHealthCheck: It looks like your strategy is filtering out a lot of data.
12
+ # Health check found 50 filtered examples but only 7 good ones.
13
+ #
14
+ # Limit the range to 31 bits to avoid this problem.
15
+ @given (x = INTEGER31_ST )
11
16
def test_double (x ):
12
17
expected = x * 2
13
18
assume (- (2 ** 31 ) <= expected <= (2 ** 31 - 1 ))
You can’t perform that action at this time.
0 commit comments