|
11 | 11 | from . import hypothesis_helpers as hh
|
12 | 12 | from . import pytest_helpers as ph
|
13 | 13 | from . import shape_helpers as sh
|
14 |
| -from . import xps |
| 14 | +from . import xps, api_version |
15 | 15 | from ._array_module import _UndefinedStub
|
16 | 16 | from .typing import DataType
|
17 | 17 |
|
@@ -145,11 +145,19 @@ def test_prod(x, data):
|
145 | 145 | _dtype = x.dtype
|
146 | 146 | else:
|
147 | 147 | _dtype = default_dtype
|
148 |
| - else: |
| 148 | + elif dh.is_float_dtype(x.dtype, real=True): |
149 | 149 | if dh.dtype_nbits[x.dtype] > dh.dtype_nbits[dh.default_float]:
|
150 | 150 | _dtype = x.dtype
|
151 | 151 | else:
|
152 | 152 | _dtype = dh.default_float
|
| 153 | + elif api_version > "2021.12": |
| 154 | + # Complex dtype |
| 155 | + if dh.dtype_nbits[x.dtype] > dh.dtype_nbits[dh.default_complex]: |
| 156 | + _dtype = x.dtype |
| 157 | + else: |
| 158 | + _dtype = dh.default_complex |
| 159 | + else: |
| 160 | + raise RuntimeError("Unexpected dtype. This indicates a bug in the test suite.") |
153 | 161 | else:
|
154 | 162 | _dtype = dtype
|
155 | 163 | if _dtype is None:
|
@@ -253,11 +261,19 @@ def test_sum(x, data):
|
253 | 261 | _dtype = x.dtype
|
254 | 262 | else:
|
255 | 263 | _dtype = default_dtype
|
256 |
| - else: |
| 264 | + elif dh.is_float_dtype(x.dtype, real=True): |
257 | 265 | if dh.dtype_nbits[x.dtype] > dh.dtype_nbits[dh.default_float]:
|
258 | 266 | _dtype = x.dtype
|
259 | 267 | else:
|
260 | 268 | _dtype = dh.default_float
|
| 269 | + elif api_version > "2021.12": |
| 270 | + # Complex dtype |
| 271 | + if dh.dtype_nbits[x.dtype] > dh.dtype_nbits[dh.default_complex]: |
| 272 | + _dtype = x.dtype |
| 273 | + else: |
| 274 | + _dtype = dh.default_complex |
| 275 | + else: |
| 276 | + raise RuntimeError("Unexpected dtype. This indicates a bug in the test suite.") |
261 | 277 | else:
|
262 | 278 | _dtype = dtype
|
263 | 279 | if _dtype is None:
|
|
0 commit comments