Skip to content

Commit da2598c

Browse files
Avoid in-place modification of ndarray.shape in TestCopyScalar
1 parent 33b2c8d commit da2598c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

dpctl/tests/test_usm_ndarray_ctor.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ def test_copy_numeric_scalar_with_func(self, func, shape, dtype):
304304
pytest.skip("No SYCL devices available")
305305
Y = np.arange(1, X.size + 1, dtype=dtype)
306306
X.usm_data.copy_from_host(Y.view("|u1"))
307-
Y.shape = tuple()
307+
Y = Y.reshape(())
308308
# Non-0D numeric arrays must not be convertible to Python scalars
309309
if len(shape) != 0:
310310
assert_raises_regex(TypeError, "only 0-dimensional arrays", func, X)
@@ -319,7 +319,7 @@ def test_copy_bool_scalar_with_method(self, shape, dtype):
319319
pytest.skip("No SYCL devices available")
320320
Y = np.arange(1, X.size + 1, dtype=dtype)
321321
X.usm_data.copy_from_host(Y.view("|u1"))
322-
Y.shape = tuple()
322+
Y = Y.reshape(())
323323
assert getattr(X, "__bool__")() == getattr(Y, "__bool__")()
324324

325325
@pytest.mark.parametrize("method", ["__float__", "__int__", "__complex__"])
@@ -330,7 +330,7 @@ def test_copy_numeric_scalar_with_method(self, method, shape, dtype):
330330
pytest.skip("No SYCL devices available")
331331
Y = np.arange(1, X.size + 1, dtype=dtype)
332332
X.usm_data.copy_from_host(Y.view("|u1"))
333-
Y.shape = tuple()
333+
Y = Y.reshape(())
334334
if len(shape) != 0:
335335
assert_raises_regex(
336336
TypeError, "only 0-dimensional arrays", getattr(X, method)

0 commit comments

Comments
 (0)