1 parent cc6f8b9 commit 4615203Copy full SHA for 4615203
2 files changed
dpnp/tests/tensor/test_usm_ndarray_ctor.py
@@ -123,6 +123,9 @@ def test_usm_ndarray_flags():
123
f = dpt.usm_ndarray((5, 0, 1), dtype="i4", strides=(1, 0, 1)).flags
124
assert f.fc
125
assert f.forc
126
+ assert not dpt.usm_ndarray(
127
+ (2, 3, 4), dtype="i4", strides=(4, 8, 1)
128
+ ).flags.forc
129
130
x = dpt.empty(5, dtype="u2")
131
assert x.flags.writable is True
@@ -1088,10 +1091,14 @@ def test_ctor_invalid_strides():
1088
1091
except dpctl.SyclDeviceCreationError:
1089
1092
pytest.skip("No SYCL devices available")
1090
1093
# negative displacement
- with pytest.raises(ValueError):
1094
+ with pytest.raises(
1095
+ ValueError, match="result in a negative memory displacement"
1096
+ ):
1097
dpt.usm_ndarray((2, 3, 4), dtype="i4", strides=(-1, 1, 1))
1098
# oversized memory footprint
1099
1100
+ ValueError, match="memory footprint exceeds the number of elements"
1101
1102
dpt.usm_ndarray((2, 3, 4), dtype="i4", strides=(1, 16, 128))
1103
1104
dpnp/tests/third_party/cupy/creation_tests/test_basic.py
@@ -282,17 +282,16 @@ def test_ndarray_strides(self, shape, strides):
282
assert cupy.byte_bounds(a)[0] == a.data.ptr
283
assert cupy.byte_bounds(a)[1] - a.data.ptr <= a.data.size
284
285
- @pytest.mark.skip("due to dpctl-2239")
286
@pytest.mark.parametrize(
287
"shape, strides",
288
[
289
- ((2, 3, 4), (8, 128, 1024)), # too large
290
- ((2, 3, 4), (-8, 8, 8)), # negative (needs offset)
+ ((2, 3, 4), (4, 512, 4096)), # too large
+ ((2, 3, 4), (-4, 4, 4)), # negative (needs offset)
291
],
292
)
293
def test_ndarray_strides_raises(self, shape, strides):
294
- with pytest.raises(ValueError, match=r"ndarray\(\) with strides.*"):
295
- cupy.ndarray(shape, strides=strides)
+ with pytest.raises(ValueError):
+ cupy.ndarray(shape, strides=strides, dtype=cupy.float32)
296
297
@testing.for_CF_orders()
298
@testing.for_all_dtypes()
0 commit comments