Skip to content

Commit f9b1af5

Browse files
Update cupy tests
1 parent 3f54026 commit f9b1af5

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

tests/third_party/cupy/math_tests/test_misc.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,13 @@ def test_clip_max_none(self, xp, dtype):
126126
a = testing.shaped_arange((2, 3, 4), xp, dtype)
127127
return a.clip(3, None)
128128

129+
# numpy>=2.0 does not raise ValueError with a_min=None, a_max=None
130+
@testing.with_requires("numpy>=2.0")
129131
@testing.for_all_dtypes(no_bool=True, no_complex=True)
130132
def test_clip_min_max_none(self, dtype):
131133
for xp in (numpy, cupy):
132134
a = testing.shaped_arange((2, 3, 4), xp, dtype)
133-
with pytest.raises(ValueError):
134-
a.clip(None, None)
135+
return a.clip(None, None)
135136

136137
@testing.for_all_dtypes(no_complex=True)
137138
@testing.numpy_cupy_array_equal()
@@ -155,8 +156,15 @@ def test_external_clip3(self, xp, dtype):
155156
def test_external_clip4(self, dtype):
156157
for xp in (numpy, cupy):
157158
a = testing.shaped_arange((2, 3, 4), xp, dtype)
158-
with pytest.raises(TypeError):
159-
xp.clip(a, 3)
159+
# dpnp.clip() has default a_min, a_max variables as None
160+
# while numpy.clip() uses np._NoValue(numpy>=2.0)
161+
# or required arguments (numpy<2.0) for a_min, a_max
162+
# and raises TypeError if passing a_min only
163+
if xp is numpy:
164+
with pytest.raises(TypeError):
165+
xp.clip(a, 3)
166+
else:
167+
return xp.clip(a, 3)
160168

161169
@testing.for_all_dtypes(no_complex=True)
162170
@testing.numpy_cupy_array_equal()

0 commit comments

Comments
 (0)