We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 97061ee commit b5265a8Copy full SHA for b5265a8
1 file changed
dpctl/tests/test_usm_ndarray_ctor.py
@@ -2368,3 +2368,28 @@ def test_gh_1201():
2368
c = dpt.flip(dpt.empty(a.shape, dtype=a.dtype))
2369
c[:] = a
2370
assert (dpt.asnumpy(c) == a).all()
2371
+
2372
2373
+class ObjWithSyclUsmArrayInterface:
2374
+ def __init__(self, ary):
2375
+ self._array_obj = ary
2376
2377
+ @property
2378
+ def __sycl_usm_array_interface__(self):
2379
+ _suai = self._array_obj.__sycl_usm_array_interface__
2380
+ return _suai
2381
2382
2383
+def test_asarray_writable_flag():
2384
+ try:
2385
+ a = dpt.empty(8)
2386
+ except dpctl.SyclDeviceCreationError:
2387
+ pytest.skip("No SYCL devices available")
2388
2389
+ a.flags["W"] = False
2390
+ wrapped = ObjWithSyclUsmArrayInterface(a)
2391
2392
+ b = dpt.asarray(wrapped)
2393
2394
+ assert not b.flags["W"]
2395
+ assert b._pointer == a._pointer
0 commit comments