Skip to content

Commit 8374c9f

Browse files
Attempt to improve coverage of astype
1 parent 5fa93f4 commit 8374c9f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

dpctl/tests/test_usm_ndarray_ctor.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -747,13 +747,13 @@ def test_to_device():
747747

748748

749749
def test_astype():
750-
X = dpt.usm_ndarray((5, 5), "i4")
750+
X = dpt.empty((5, 5), dtype="i4")
751751
X[:] = np.full((5, 5), 7, dtype="i4")
752752
Y = dpt.astype(X, "c16", order="C")
753753
assert np.allclose(dpt.to_numpy(Y), np.full((5, 5), 7, dtype="c16"))
754-
Y = dpt.astype(X, "f2", order="K")
755-
assert np.allclose(dpt.to_numpy(Y), np.full((5, 5), 7, dtype="f2"))
756-
Y = dpt.astype(X, "i4", order="K", copy=False)
754+
Y = dpt.astype(X[::2, ::-1], "f2", order="K")
755+
assert np.allclose(dpt.to_numpy(Y), np.full(Y.shape, 7, dtype="f2"))
756+
Y = dpt.astype(X[::2, ::-1], "i4", order="K", copy=False)
757757
assert Y.usm_data is X.usm_data
758758

759759

0 commit comments

Comments
 (0)