File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -2368,3 +2368,28 @@ def test_gh_1201():
2368
2368
c = dpt .flip (dpt .empty (a .shape , dtype = a .dtype ))
2369
2369
c [:] = a
2370
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
You can’t perform that action at this time.
0 commit comments