@@ -2701,7 +2701,16 @@ def test_sparse_mixed_domain_uint_float64(self, sparse_cell_order):
2701
2701
self .assertEqual (a_nonempty [0 ], (0 , 49 ))
2702
2702
self .assertEqual (a_nonempty [1 ], (- 100.0 , 100.0 ))
2703
2703
2704
- def test_sparse_string_domain (self , sparse_cell_order ):
2704
+ @pytest .mark .parametrize (
2705
+ "coords, expected_ned, allows_duplicates" ,
2706
+ [
2707
+ ([b"aa" , b"bbb" , b"c" , b"dddd" ], [b"aa" , b"dddd" ], False ),
2708
+ ([b"" , b"" , b"" , b"" ], [b"" , b"" ], True ),
2709
+ ],
2710
+ )
2711
+ def test_sparse_string_domain (
2712
+ self , coords , expected_ned , allows_duplicates , sparse_cell_order
2713
+ ):
2705
2714
path = self .path ("sparse_string_domain" )
2706
2715
dom = tiledb .Domain (tiledb .Dim (name = "d" , domain = (None , None ), dtype = np .bytes_ ))
2707
2716
att = tiledb .Attr (name = "a" , dtype = np .int64 )
@@ -2710,12 +2719,12 @@ def test_sparse_string_domain(self, sparse_cell_order):
2710
2719
attrs = (att ,),
2711
2720
sparse = True ,
2712
2721
cell_order = sparse_cell_order ,
2722
+ allows_duplicates = allows_duplicates ,
2713
2723
capacity = 10000 ,
2714
2724
)
2715
2725
tiledb .SparseArray .create (path , schema )
2716
2726
2717
2727
data = [1 , 2 , 3 , 4 ]
2718
- coords = [b"aa" , b"bbb" , b"c" , b"dddd" ]
2719
2728
2720
2729
with tiledb .open (path , "w" ) as A :
2721
2730
A [coords ] = data
@@ -2725,7 +2734,8 @@ def test_sparse_string_domain(self, sparse_cell_order):
2725
2734
res = A [ned [0 ] : ned [1 ]]
2726
2735
assert_array_equal (res ["a" ], data )
2727
2736
self .assertEqual (set (res ["d" ]), set (coords ))
2728
- self .assertEqual (A .nonempty_domain (), ((b"aa" , b"dddd" ),))
2737
+ # self.assertEqual(A.nonempty_domain(), ((b"aa", b"dddd"),))
2738
+ self .assertEqual (A .nonempty_domain (), ((tuple (expected_ned )),))
2729
2739
2730
2740
def test_sparse_string_domain2 (self , sparse_cell_order ):
2731
2741
path = self .path ("sparse_string_domain2" )
0 commit comments