Skip to content

Commit 4615203

Browse files
Update tests
1 parent cc6f8b9 commit 4615203

2 files changed

Lines changed: 13 additions & 7 deletions

File tree

‎dpnp/tests/tensor/test_usm_ndarray_ctor.py‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ def test_usm_ndarray_flags():
123123
f = dpt.usm_ndarray((5, 0, 1), dtype="i4", strides=(1, 0, 1)).flags
124124
assert f.fc
125125
assert f.forc
126+
assert not dpt.usm_ndarray(
127+
(2, 3, 4), dtype="i4", strides=(4, 8, 1)
128+
).flags.forc
126129

127130
x = dpt.empty(5, dtype="u2")
128131
assert x.flags.writable is True
@@ -1088,10 +1091,14 @@ def test_ctor_invalid_strides():
10881091
except dpctl.SyclDeviceCreationError:
10891092
pytest.skip("No SYCL devices available")
10901093
# negative displacement
1091-
with pytest.raises(ValueError):
1094+
with pytest.raises(
1095+
ValueError, match="result in a negative memory displacement"
1096+
):
10921097
dpt.usm_ndarray((2, 3, 4), dtype="i4", strides=(-1, 1, 1))
10931098
# oversized memory footprint
1094-
with pytest.raises(ValueError):
1099+
with pytest.raises(
1100+
ValueError, match="memory footprint exceeds the number of elements"
1101+
):
10951102
dpt.usm_ndarray((2, 3, 4), dtype="i4", strides=(1, 16, 128))
10961103

10971104

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -282,17 +282,16 @@ def test_ndarray_strides(self, shape, strides):
282282
assert cupy.byte_bounds(a)[0] == a.data.ptr
283283
assert cupy.byte_bounds(a)[1] - a.data.ptr <= a.data.size
284284

285-
@pytest.mark.skip("due to dpctl-2239")
286285
@pytest.mark.parametrize(
287286
"shape, strides",
288287
[
289-
((2, 3, 4), (8, 128, 1024)), # too large
290-
((2, 3, 4), (-8, 8, 8)), # negative (needs offset)
288+
((2, 3, 4), (4, 512, 4096)), # too large
289+
((2, 3, 4), (-4, 4, 4)), # negative (needs offset)
291290
],
292291
)
293292
def test_ndarray_strides_raises(self, shape, strides):
294-
with pytest.raises(ValueError, match=r"ndarray\(\) with strides.*"):
295-
cupy.ndarray(shape, strides=strides)
293+
with pytest.raises(ValueError):
294+
cupy.ndarray(shape, strides=strides, dtype=cupy.float32)
296295

297296
@testing.for_CF_orders()
298297
@testing.for_all_dtypes()

0 commit comments

Comments
 (0)