Skip to content

Commit a4c8648

Browse files
committed
speed up test_shrinks_downwards_to_integers
1 parent 75d1f42 commit a4c8648

File tree

1 file changed

+5
-17
lines changed

1 file changed

+5
-17
lines changed

hypothesis-python/tests/quality/test_float_shrinking.py

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,7 @@
1010

1111
import pytest
1212

13-
from hypothesis import (
14-
HealthCheck,
15-
Verbosity,
16-
example,
17-
given,
18-
settings,
19-
strategies as st,
20-
)
13+
from hypothesis import example, given, strategies as st
2114
from hypothesis.internal.compat import ceil
2215

2316
from tests.common.debug import minimal
@@ -39,21 +32,16 @@ def test_can_shrink_in_variable_sized_context(n):
3932
@example(1.7976931348623157e308)
4033
@example(1.5)
4134
@given(st.floats(min_value=0, allow_infinity=False, allow_nan=False))
42-
@settings(deadline=None, suppress_health_check=list(HealthCheck))
4335
def test_shrinks_downwards_to_integers(f):
44-
g = minimal(
45-
st.floats().filter(lambda x: x >= f),
46-
settings=settings(verbosity=Verbosity.quiet, max_examples=10**6),
47-
)
48-
assert g == ceil(f)
36+
assert minimal(st.floats(min_value=f)) == ceil(f)
4937

5038

5139
@example(1)
5240
@given(st.integers(1, 2**16 - 1))
53-
@settings(deadline=None, suppress_health_check=list(HealthCheck), max_examples=10)
5441
def test_shrinks_downwards_to_integers_when_fractional(b):
5542
g = minimal(
56-
st.floats().filter(lambda x: b < x < 2**53 and int(x) != x),
57-
settings=settings(verbosity=Verbosity.quiet, max_examples=10**6),
43+
st.floats(
44+
min_value=b, max_value=2**53, exclude_min=True, exclude_max=True
45+
).filter(lambda x: int(x) != x)
5846
)
5947
assert g == b + 0.5

0 commit comments

Comments
 (0)