Skip to content

Commit e363969

Browse files
Tests should not use double precision arrays where it is not essential for testing
1 parent f6db04e commit e363969

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

dpctl/tests/test_usm_ndarray_manipulation.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def test_expand_dims_tuple(axes):
152152
except dpctl.SyclQueueCreationError:
153153
pytest.skip("Queue could not be created")
154154

155-
Xnp = np.empty((3, 3, 3))
155+
Xnp = np.empty((3, 3, 3), dtype="u1")
156156
X = dpt.asarray(Xnp, sycl_queue=q)
157157
Y = dpt.expand_dims(X, axes)
158158
Ynp = np.expand_dims(Xnp, axes)
@@ -234,7 +234,7 @@ def test_squeeze_without_axes(shapes):
234234
except dpctl.SyclQueueCreationError:
235235
pytest.skip("Queue could not be created")
236236

237-
Xnp = np.empty(shapes)
237+
Xnp = np.empty(shapes, dtype="u1")
238238
X = dpt.asarray(Xnp, sycl_queue=q)
239239
Y = dpt.squeeze(X)
240240
Ynp = Xnp.squeeze()
@@ -248,7 +248,7 @@ def test_squeeze_axes_arg(axes):
248248
except dpctl.SyclQueueCreationError:
249249
pytest.skip("Queue could not be created")
250250

251-
Xnp = np.array([[[1], [2], [3]]])
251+
Xnp = np.array([[[1], [2], [3]]], dtype="u1")
252252
X = dpt.asarray(Xnp, sycl_queue=q)
253253
Y = dpt.squeeze(X, axes)
254254
Ynp = Xnp.squeeze(axes)
@@ -262,29 +262,29 @@ def test_squeeze_axes_arg_error(axes):
262262
except dpctl.SyclQueueCreationError:
263263
pytest.skip("Queue could not be created")
264264

265-
Xnp = np.array([[[1], [2], [3]]])
265+
Xnp = np.array([[[1], [2], [3]]], dtype="u1")
266266
X = dpt.asarray(Xnp, sycl_queue=q)
267267
pytest.raises(ValueError, dpt.squeeze, X, axes)
268268

269269

270270
@pytest.mark.parametrize(
271271
"data",
272272
[
273-
[np.array(0), (0,)],
274-
[np.array(0), (1,)],
275-
[np.array(0), (3,)],
276-
[np.ones(1), (1,)],
277-
[np.ones(1), (2,)],
278-
[np.ones(1), (1, 2, 3)],
279-
[np.arange(3), (3,)],
280-
[np.arange(3), (1, 3)],
281-
[np.arange(3), (2, 3)],
282-
[np.ones(0), 0],
283-
[np.ones(1), 1],
284-
[np.ones(1), 2],
285-
[np.ones(1), (0,)],
286-
[np.ones((1, 2)), (0, 2)],
287-
[np.ones((2, 1)), (2, 0)],
273+
[np.array(0, dtype="u1"), (0,)],
274+
[np.array(0, dtype="u1"), (1,)],
275+
[np.array(0, dtype="u1"), (3,)],
276+
[np.ones(1, dtype="u1"), (1,)],
277+
[np.ones(1, dtype="u1"), (2,)],
278+
[np.ones(1, dtype="u1"), (1, 2, 3)],
279+
[np.arange(3, dtype="u1"), (3,)],
280+
[np.arange(3, dtype="u1"), (1, 3)],
281+
[np.arange(3, dtype="u1"), (2, 3)],
282+
[np.ones(0, dtype="u1"), 0],
283+
[np.ones(1, dtype="u1"), 1],
284+
[np.ones(1, dtype="u1"), 2],
285+
[np.ones(1, dtype="u1"), (0,)],
286+
[np.ones((1, 2), dtype="u1"), (0, 2)],
287+
[np.ones((2, 1), dtype="u1"), (2, 0)],
288288
],
289289
)
290290
def test_broadcast_to_succeeds(data):
@@ -323,7 +323,7 @@ def test_broadcast_to_raises(data):
323323
pytest.skip("Queue could not be created")
324324

325325
orig_shape, target_shape = data
326-
Xnp = np.zeros(orig_shape)
326+
Xnp = np.zeros(orig_shape, dtype="i1")
327327
X = dpt.asarray(Xnp, sycl_queue=q)
328328
pytest.raises(ValueError, dpt.broadcast_to, X, target_shape)
329329

@@ -333,7 +333,7 @@ def assert_broadcast_correct(input_shapes):
333333
q = dpctl.SyclQueue()
334334
except dpctl.SyclQueueCreationError:
335335
pytest.skip("Queue could not be created")
336-
np_arrays = [np.zeros(s) for s in input_shapes]
336+
np_arrays = [np.zeros(s, dtype="i1") for s in input_shapes]
337337
out_np_arrays = np.broadcast_arrays(*np_arrays)
338338
usm_arrays = [dpt.asarray(Xnp, sycl_queue=q) for Xnp in np_arrays]
339339
out_usm_arrays = dpt.broadcast_arrays(*usm_arrays)

0 commit comments

Comments
 (0)