Skip to content

Commit 2d86fc2

Browse files
authored
Addition of test_from_numpy_empty_str Unit Test (#1089)
1 parent e31e0f8 commit 2d86fc2

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
### DO NOT USE ON CI
2222

2323
# Target branch: Note that this should be set to the current core release, not `dev`
24-
TILEDB_VERSION = "2.10.4"
24+
TILEDB_VERSION = "2.11.0"
25+
2526
# allow overriding w/ environment variable
2627
TILEDB_VERSION = os.environ.get("TILEDB_VERSION") or TILEDB_VERSION
2728

tiledb/tests/test_libtiledb.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1849,13 +1849,7 @@ def test_varlen_write_bytes(self):
18491849
assert_array_equal(A, T.multi_index[1 : len(A)][""])
18501850

18511851
def test_varlen_sparse_all_empty_strings(self):
1852-
# this test addresses a fix for specific need for reads on a
1853-
# large existing array, see
1854-
# https://github.com/TileDB-Inc/TileDB-Py/pull/475
1855-
# we currently have to write a placeholder at the end to
1856-
# avoid zero-length cell error
1857-
# TODO: follow-up with improved testing for empty var-length/strings
1858-
A = np.array(["", "", "", "", "", "\x00"], dtype=object)
1852+
A = np.array(["", "", "", "", ""], dtype=object)
18591853
dim_len = len(A)
18601854
uri = self.path("varlen_all_empty_strings")
18611855

@@ -3673,6 +3667,19 @@ def test_from_numpy_append_array3d_overwrite(self, append_dim):
36733667
assert A.nonempty_domain() == ((0, 1), (0, 1), (0, 1))
36743668
assert_array_equal(A[0:2, 0:2, 0:2], arr2)
36753669

3670+
@pytest.mark.parametrize("empty_str", ["", b""])
3671+
@pytest.mark.parametrize("num_strs", [1, 1000])
3672+
def test_from_numpy_empty_str(self, empty_str, num_strs):
3673+
uri = self.path("test_from_numpy_empty_str")
3674+
np_array = np.asarray([empty_str] * num_strs, dtype="O")
3675+
tiledb.from_numpy(uri, np_array)
3676+
3677+
with tiledb.open(uri, "r") as A:
3678+
assert_array_equal(A[:], np_array)
3679+
if has_pandas():
3680+
assert_array_equal(A.query(use_arrow=True).df[:][""], np_array)
3681+
assert_array_equal(A.query(use_arrow=False).df[:][""], np_array)
3682+
36763683

36773684
class ConsolidationTest(DiskTestCase):
36783685
def test_array_vacuum(self):

0 commit comments

Comments
 (0)