@@ -2492,6 +2492,63 @@ def test_index_2d(self):
2492
2492
with self .assertRaises (IndexError ):
2493
2493
T [idx ]
2494
2494
2495
+ def test_dense_array_with_negative_domain (self ):
2496
+ path = self .path ("test_dense_array_with_negative_domain" )
2497
+ attr = tiledb .Attr (dtype = np .uint8 )
2498
+ dom = tiledb .Domain (tiledb .Dim ("X" , domain = (- 10 , 10 ), dtype = np .int64 ))
2499
+ schema = tiledb .ArraySchema (domain = dom , sparse = False , attrs = [attr ])
2500
+ tiledb .Array .create (path , schema )
2501
+ data = np .random .randint (10 , size = 21 )
2502
+
2503
+ with tiledb .open (path , "w" ) as A :
2504
+ with pytest .raises (tiledb .TileDBError ):
2505
+ A [- 5 :5 ] = np .random .randint (10 , size = 11 )
2506
+ with pytest .raises (tiledb .TileDBError ):
2507
+ A [:0 ] = np .random .randint (10 , size = 11 )
2508
+ with pytest .raises (tiledb .TileDBError ):
2509
+ A [0 :] = np .random .randint (10 , size = 11 )
2510
+ with pytest .raises (tiledb .TileDBError ):
2511
+ A [0 ] = np .random .randint (10 , size = 1 )
2512
+ A [:] = data
2513
+
2514
+ with tiledb .open (path , "r" ) as A :
2515
+ with pytest .raises (tiledb .TileDBError ):
2516
+ A [- 5 :5 ]
2517
+ with pytest .raises (tiledb .TileDBError ):
2518
+ A [:0 ]
2519
+ with pytest .raises (tiledb .TileDBError ):
2520
+ A [0 :]
2521
+ with pytest .raises (tiledb .TileDBError ):
2522
+ A [0 ]
2523
+ assert_array_equal (A [:], data [:])
2524
+
2525
+ def test_dense_array_with_2d_negative_domain (self ):
2526
+ path = self .path ("test_dense_array_with_2d_negative_domain" )
2527
+ attr = tiledb .Attr (dtype = np .uint8 )
2528
+ dim1 = tiledb .Dim ("X" , domain = (- 10 , 10 ), dtype = np .int64 )
2529
+ dim2 = tiledb .Dim ("Y" , domain = (0 , 10 ), dtype = np .int64 )
2530
+ dom = tiledb .Domain (dim1 , dim2 )
2531
+ schema = tiledb .ArraySchema (domain = dom , sparse = False , attrs = [attr ])
2532
+ tiledb .Array .create (path , schema )
2533
+ data = np .random .randint (10 , size = (21 ,11 ))
2534
+
2535
+ with tiledb .open (path , "w" ) as A :
2536
+ with pytest .raises (tiledb .TileDBError ):
2537
+ A [:,- 5 :5 ] = np .random .randint (10 , size = 11 )
2538
+ with pytest .raises (tiledb .TileDBError ):
2539
+ A [:0 , :] = np .random .randint (10 , size = 11 )
2540
+ with pytest .raises (tiledb .TileDBError ):
2541
+ A [0 ] = np .random .randint (10 , size = 1 )
2542
+ A [:] = data
2543
+
2544
+ with tiledb .open (path , "r" ) as A :
2545
+ with pytest .raises (tiledb .TileDBError ):
2546
+ A [:,- 5 :5 ]
2547
+ with pytest .raises (tiledb .TileDBError ):
2548
+ A [:0 , :]
2549
+ with pytest .raises (tiledb .TileDBError ):
2550
+ A [0 ]
2551
+ assert_array_equal (A [:], data [:])
2495
2552
2496
2553
class TestDatetimeSlicing (DiskTestCase ):
2497
2554
def test_dense_datetime_vector (self ):
0 commit comments