@@ -503,7 +503,7 @@ def test_array_1d(self):
503
503
# basic step
504
504
assert_array_equal (A [:50 :2 ], T [:50 :2 ])
505
505
assert_array_equal (A [:2 :50 ], T [:2 :50 ])
506
- assert_array_equal (A [10 :- 1 :50 ], T [10 :- 1 :50 ])
506
+ assert_array_equal (A [10 :- 1 :50 ], T [10 :1049 :50 ])
507
507
508
508
# indexing errors
509
509
with self .assertRaises (IndexError ):
@@ -1247,7 +1247,7 @@ def test_varlen_sparse_all_empty_strings(self):
1247
1247
1248
1248
with tiledb .open (uri , mode = "r" ) as T :
1249
1249
# check interior range
1250
- assert_array_equal (A [1 :- 1 ], T [2 : - 1 ]["a1" ])
1250
+ assert_array_equal (A [1 :- 1 ], T [1 : dim_len - 1 ]["a1" ])
1251
1251
assert_array_equal (A [1 :- 1 ], T .multi_index [2 : dim_len - 1 ]["a1" ])
1252
1252
1253
1253
def test_varlen_write_unicode (self ):
@@ -1521,6 +1521,51 @@ def test_array_varlen_2d_s_fixed(self):
1521
1521
with tiledb .DenseArray (uri ) as T :
1522
1522
assert_array_equal (A , T )
1523
1523
1524
+ @pytest .mark .parametrize ("lo,hi" , [(- 20 , - 10 ), (- 10 , 0 ), (0 , 10 ), (10 , 20 )])
1525
+ def test_dense_array_with_negative_positive_domain (self , lo , hi ):
1526
+ path = self .path ("test_dense_array_with_negative_domain" )
1527
+ attr = tiledb .Attr (dtype = np .uint8 )
1528
+ dom = tiledb .Domain (tiledb .Dim ("X" , domain = (- 20 , 20 ),dtype = np .int64 ))
1529
+ schema = tiledb .ArraySchema (domain = dom , sparse = False , attrs = [attr ])
1530
+ tiledb .Array .create (path , schema )
1531
+ data = np .random .randint (10 , size = (hi - lo ))
1532
+
1533
+ with tiledb .open (path , 'w' ) as A :
1534
+ A [lo :hi ] = data
1535
+
1536
+ with tiledb .open (path , 'r' ) as A :
1537
+ assert_array_equal (A [lo :hi ], data [:])
1538
+
1539
+
1540
+ @pytest .mark .parametrize ("lo,hi" , [(- 20 , - 10 ), (- 20 , - 15 ), (- 15 , - 10 ), (- 17 , - 13 )])
1541
+ def test_dense_array_with_negative_negative_domain (self , lo , hi ):
1542
+ path = self .path ("test_dense_array_with_negative_negative_domain" )
1543
+ attr = tiledb .Attr (dtype = np .uint8 )
1544
+ dom = tiledb .Domain (tiledb .Dim ("X" , domain = (- 20 , - 10 ),dtype = np .int64 ))
1545
+ schema = tiledb .ArraySchema (domain = dom , sparse = False , attrs = [attr ])
1546
+ tiledb .Array .create (path , schema )
1547
+ data = np .random .randint (10 , size = (hi - lo ))
1548
+
1549
+ with tiledb .open (path , 'w' ) as A :
1550
+ A [lo :hi ] = data
1551
+
1552
+ with tiledb .open (path , 'r' ) as A :
1553
+ assert_array_equal (A [lo :hi ], data [:])
1554
+
1555
+ @pytest .mark .parametrize ("lo,hi" , [(10 , 20 ), (10 ,15 ),(12 ,15 ), (17 ,20 )])
1556
+ def test_dense_array_with_offset_domain (self , lo , hi ):
1557
+ path = self .path ("test_dense_array_with_offset_domain" )
1558
+ attr = tiledb .Attr (dtype = np .uint8 )
1559
+ dom = tiledb .Domain (tiledb .Dim ("X" , domain = (10 , 20 ),dtype = np .int64 ))
1560
+ schema = tiledb .ArraySchema (domain = dom , sparse = False , attrs = [attr ])
1561
+ tiledb .Array .create (path , schema )
1562
+ data = np .random .randint (10 , size = (hi - lo ))
1563
+
1564
+ with tiledb .open (path , 'w' ) as A :
1565
+ A [lo :hi ] = data
1566
+
1567
+ with tiledb .open (path , 'r' ) as A :
1568
+ assert_array_equal (A [lo :hi ], data [:])
1524
1569
1525
1570
class TestSparseArray (DiskTestCase ):
1526
1571
@pytest .mark .xfail
0 commit comments