@@ -441,7 +441,7 @@ def test_slicing_basic():
441441 Xusm [:, - 4 ]
442442 with pytest .raises (IndexError ):
443443 Xusm [:, - 128 ]
444- with pytest .raises (TypeError ):
444+ with pytest .raises (IndexError ):
445445 Xusm [{1 , 2 , 3 , 4 , 5 , 6 , 7 }]
446446 X = dpt .usm_ndarray (10 , "u1" )
447447 X .usm_data .copy_from_host (b"\x00 \x01 \x02 \x03 \x04 \x05 \x06 \x07 \x08 \x09 " )
@@ -2416,3 +2416,25 @@ def test_asarray_writable_flag(ro_flag):
24162416
24172417 assert b .flags ["W" ] == (not ro_flag )
24182418 assert b ._pointer == a ._pointer
2419+
2420+
2421+ def test_getitem_validation ():
2422+ """Test based on gh-1785"""
2423+ try :
2424+ a = dpt .empty ((2 , 2 , 2 ))
2425+ except dpctl .SyclDeviceCreationError :
2426+ pytest .skip ("No SYCL devices available" )
2427+ with pytest .raises (IndexError ):
2428+ a [0.0 ]
2429+ with pytest .raises (IndexError ):
2430+ a [1 , 0.0 , ...]
2431+ with pytest .raises (IndexError ):
2432+ a [1 , 0.0 , dpt .newaxis , 1 ]
2433+ with pytest .raises (IndexError ):
2434+ a [dpt .newaxis , ..., 0.0 ]
2435+ with pytest .raises (IndexError ):
2436+ a [dpt .newaxis , ..., 0.0 , dpt .newaxis ]
2437+ with pytest .raises (IndexError ):
2438+ a [..., 0.0 , dpt .newaxis ]
2439+ with pytest .raises (IndexError ):
2440+ a [:, 0.0 , dpt .newaxis ]
0 commit comments