Skip to content

Commit 7cb00c8

Browse files
committed
Avoid overflow in linspace test
1 parent a804dd7 commit 7cb00c8

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

dpnp/tests/third_party/cupy/creation_tests/test_ranges.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,13 @@ def test_linspace_mixed_start_stop2(self, xp, dtype_range, dtype_out):
226226
# TODO (ev-br): np 2.0: check if can re-enable float16
227227
# TODO (ev-br): np 2.0: had to bump the default rtol on Windows
228228
# and numpy 1.26+weak promotion from 0 to 5e-6
229-
if xp.dtype(dtype_range).kind in "u":
229+
if xp.dtype(dtype_range).kind == "u":
230230
# to avoid overflow, limit `val` to be smaller
231231
# than xp.iinfo(dtype).max
232-
if dtype_range in [xp.uint8, xp.uint16] or dtype_out == xp.uint8:
232+
if dtype_range in [xp.uint8, xp.uint16] or dtype_out in [
233+
xp.int8,
234+
xp.uint8,
235+
]:
233236
val = 125
234237
else:
235238
val = 160

0 commit comments

Comments
 (0)