Skip to content

Commit aec9934

Browse files
authored
Update third party tests since support of shape=None was dropped in numpy 2.3 (#2484)
The PR updates third party tests, since numpy 2.3 [dropped](https://numpy.org/devdocs/release/2.3.0-notes.html#expired-deprecations) support of passing `shape=None` to functions with a non-optional shape argument errors.
1 parent 0d01250 commit aec9934

File tree

3 files changed

+13
-22
lines changed

3 files changed

+13
-22
lines changed

dpnp/tests/third_party/cupy/core_tests/test_internal.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@ def test_two(self):
3838

3939
class TestGetSize:
4040

41-
def test_none(self):
42-
with testing.assert_warns(DeprecationWarning):
43-
assert internal.get_size(None) == ()
44-
4541
def check_collection(self, a):
4642
assert internal.get_size(a) == tuple(a)
4743

dpnp/tests/third_party/cupy/core_tests/test_ndarray.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,10 @@ def wrap_take(array, *args, **kwargs):
2525

2626

2727
class TestNdarrayInit(unittest.TestCase):
28-
@pytest.mark.skip("passing 'None' into shape arguments is not supported")
28+
2929
def test_shape_none(self):
30-
with testing.assert_warns(DeprecationWarning):
31-
a = cupy.ndarray(None)
32-
assert a.shape == ()
30+
with pytest.raises(TypeError):
31+
cupy.ndarray(None)
3332

3433
def test_shape_int(self):
3534
a = cupy.ndarray(3)

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

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,13 @@ def test_empty_scalar(self, xp, dtype, order):
4747
a.fill(0)
4848
return a
4949

50-
@pytest.mark.skip("passing 'None' into shape arguments is not supported")
51-
@testing.with_requires("numpy>=1.20")
50+
@testing.with_requires("numpy>=2.3")
5251
@testing.for_CF_orders()
5352
@testing.for_all_dtypes()
54-
@testing.numpy_cupy_array_equal()
55-
def test_empty_scalar_none(self, xp, dtype, order):
56-
with testing.assert_warns(DeprecationWarning):
57-
a = xp.empty(None, dtype=dtype, order=order)
58-
a.fill(0)
59-
return a
53+
def test_empty_scalar_none(self, dtype, order):
54+
for xp in (numpy, cupy):
55+
with pytest.raises(TypeError):
56+
xp.empty(None, dtype=dtype, order=order)
6057

6158
@testing.for_CF_orders()
6259
@testing.for_all_dtypes()
@@ -206,14 +203,13 @@ def test_zeros(self, xp, dtype, order):
206203
def test_zeros_scalar(self, xp, dtype, order):
207204
return xp.zeros((), dtype=dtype, order=order)
208205

209-
@pytest.mark.skip("passing 'None' into shape arguments is not supported")
210-
@testing.with_requires("numpy>=1.20")
206+
@testing.with_requires("numpy>=2.3")
211207
@testing.for_CF_orders()
212208
@testing.for_all_dtypes()
213-
@testing.numpy_cupy_array_equal()
214-
def test_zeros_scalar_none(self, xp, dtype, order):
215-
with testing.assert_warns(DeprecationWarning):
216-
return xp.zeros(None, dtype=dtype, order=order)
209+
def test_zeros_scalar_none(self, dtype, order):
210+
for xp in (numpy, cupy):
211+
with pytest.raises(TypeError):
212+
xp.zeros(None, dtype=dtype, order=order)
217213

218214
@testing.for_CF_orders()
219215
@testing.for_all_dtypes()

0 commit comments

Comments
 (0)