Skip to content

Commit e82a231

Browse files
committed
WIP expand test_sparse_string_domain for empty strings
1 parent 852673c commit e82a231

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

tiledb/tests/test_libtiledb.py

+13-3
Original file line numberDiff line numberDiff line change
@@ -2701,7 +2701,16 @@ def test_sparse_mixed_domain_uint_float64(self, sparse_cell_order):
27012701
self.assertEqual(a_nonempty[0], (0, 49))
27022702
self.assertEqual(a_nonempty[1], (-100.0, 100.0))
27032703

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+
):
27052714
path = self.path("sparse_string_domain")
27062715
dom = tiledb.Domain(tiledb.Dim(name="d", domain=(None, None), dtype=np.bytes_))
27072716
att = tiledb.Attr(name="a", dtype=np.int64)
@@ -2710,12 +2719,12 @@ def test_sparse_string_domain(self, sparse_cell_order):
27102719
attrs=(att,),
27112720
sparse=True,
27122721
cell_order=sparse_cell_order,
2722+
allows_duplicates=allows_duplicates,
27132723
capacity=10000,
27142724
)
27152725
tiledb.SparseArray.create(path, schema)
27162726

27172727
data = [1, 2, 3, 4]
2718-
coords = [b"aa", b"bbb", b"c", b"dddd"]
27192728

27202729
with tiledb.open(path, "w") as A:
27212730
A[coords] = data
@@ -2725,7 +2734,8 @@ def test_sparse_string_domain(self, sparse_cell_order):
27252734
res = A[ned[0] : ned[1]]
27262735
assert_array_equal(res["a"], data)
27272736
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)),))
27292739

27302740
def test_sparse_string_domain2(self, sparse_cell_order):
27312741
path = self.path("sparse_string_domain2")

0 commit comments

Comments
 (0)