10
10
11
11
import pytest
12
12
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
21
14
from hypothesis .internal .compat import ceil
22
15
23
16
from tests .common .debug import minimal
@@ -39,21 +32,16 @@ def test_can_shrink_in_variable_sized_context(n):
39
32
@example (1.7976931348623157e308 )
40
33
@example (1.5 )
41
34
@given (st .floats (min_value = 0 , allow_infinity = False , allow_nan = False ))
42
- @settings (deadline = None , suppress_health_check = list (HealthCheck ))
43
35
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 )
49
37
50
38
51
39
@example (1 )
52
40
@given (st .integers (1 , 2 ** 16 - 1 ))
53
- @settings (deadline = None , suppress_health_check = list (HealthCheck ), max_examples = 10 )
54
41
def test_shrinks_downwards_to_integers_when_fractional (b ):
55
42
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 )
58
46
)
59
47
assert g == b + 0.5
0 commit comments