|
12 | 12 | from . import xps
|
13 | 13 |
|
14 | 14 | from hypothesis import assume, given
|
15 |
| -from hypothesis.strategies import integers, floats, one_of, none, booleans, just, shared, composite |
| 15 | +from hypothesis.strategies import integers, floats, one_of, none, booleans, just, shared, composite, SearchStrategy |
16 | 16 |
|
17 | 17 |
|
18 | 18 | int_range = integers(-MAX_ARRAY_SIZE, MAX_ARRAY_SIZE)
|
@@ -128,10 +128,20 @@ def test_eye(n_rows, n_cols, k, dtype):
|
128 | 128 | assert a[i, j] == 0, "eye() did not produce a 0 off the diagonal"
|
129 | 129 |
|
130 | 130 |
|
| 131 | +default_unsafe_dtypes = [xp.uint64] |
| 132 | +if dh.default_int == xp.int32: |
| 133 | + default_unsafe_dtypes.extend([xp.uint32, xp.int64]) |
| 134 | +if dh.default_float == xp.float32: |
| 135 | + default_unsafe_dtypes.append(xp.float64) |
| 136 | +default_safe_scalar_dtypes: SearchStrategy = xps.scalar_dtypes().filter( |
| 137 | + lambda d: d not in default_unsafe_dtypes |
| 138 | +) |
| 139 | + |
| 140 | + |
131 | 141 | @composite
|
132 | 142 | def full_fill_values(draw):
|
133 | 143 | kw = draw(shared(kwargs(dtype=none() | xps.scalar_dtypes()), key="full_kw"))
|
134 |
| - dtype = kw.get("dtype", None) or draw(xps.scalar_dtypes()) |
| 144 | + dtype = kw.get("dtype", None) or draw(default_safe_scalar_dtypes) |
135 | 145 | return draw(xps.from_dtype(dtype))
|
136 | 146 |
|
137 | 147 |
|
|
0 commit comments