|
5 | 5 | assert_exactly_equal, isintegral, is_float_dtype)
|
6 | 6 | from .hypothesis_helpers import (numeric_dtypes, dtypes, MAX_ARRAY_SIZE, promotable_dtypes,
|
7 | 7 | shapes, sizes, sqrt_sizes, shared_dtypes,
|
8 |
| - scalars, xps) |
| 8 | + scalars, xps, shared_optional_promotable_dtypes) |
9 | 9 |
|
10 | 10 | from hypothesis import assume, given
|
11 | 11 | from hypothesis.strategies import integers, floats, one_of, none, booleans, just
|
12 | 12 |
|
| 13 | + |
| 14 | + |
13 | 15 | int_range = integers(-MAX_ARRAY_SIZE, MAX_ARRAY_SIZE)
|
14 | 16 | float_range = floats(-MAX_ARRAY_SIZE, MAX_ARRAY_SIZE,
|
15 | 17 | allow_nan=False)
|
@@ -84,7 +86,7 @@ def test_empty(shape, dtype):
|
84 | 86 | dtype=shared_dtypes,
|
85 | 87 | shape=shapes,
|
86 | 88 | ),
|
87 |
| - dtype=one_of(none(), promotable_dtypes(shared_dtypes)), |
| 89 | + dtype=shared_optional_promotable_dtypes, |
88 | 90 | )
|
89 | 91 | def test_empty_like(a, dtype):
|
90 | 92 | kwargs = {} if dtype is None else {'dtype': dtype}
|
@@ -156,7 +158,7 @@ def test_full(shape, fill_value, dtype):
|
156 | 158 | shape=shapes,
|
157 | 159 | ),
|
158 | 160 | fill_value=promotable_dtypes(shared_dtypes).flatmap(xps.from_dtype),
|
159 |
| - dtype=one_of(none(), promotable_dtypes(shared_dtypes)), |
| 161 | + dtype=shared_optional_promotable_dtypes, |
160 | 162 | )
|
161 | 163 | def test_full_like(a, fill_value, dtype):
|
162 | 164 | kwargs = {} if dtype is None else {'dtype': dtype}
|
@@ -247,7 +249,7 @@ def test_ones(shape, dtype):
|
247 | 249 | dtype=shared_dtypes,
|
248 | 250 | shape=shapes,
|
249 | 251 | ),
|
250 |
| - dtype=one_of(none(), promotable_dtypes(shared_dtypes)), |
| 252 | + dtype=shared_optional_promotable_dtypes, |
251 | 253 | )
|
252 | 254 | def test_ones_like(a, dtype):
|
253 | 255 | kwargs = {} if dtype is None else {'dtype': dtype}
|
@@ -298,7 +300,7 @@ def test_zeros(shape, dtype):
|
298 | 300 | dtype=shared_dtypes,
|
299 | 301 | shape=shapes,
|
300 | 302 | ),
|
301 |
| - dtype=one_of(none(), promotable_dtypes(shared_dtypes)), |
| 303 | + dtype=shared_optional_promotable_dtypes, |
302 | 304 | )
|
303 | 305 | def test_zeros_like(a, dtype):
|
304 | 306 | kwargs = {} if dtype is None else {'dtype': dtype}
|
|
0 commit comments