From 003a669e89ddc2f07387124b9697c4839ca9f4f9 Mon Sep 17 00:00:00 2001 From: John Kerl Date: Thu, 17 Oct 2024 14:37:16 -0400 Subject: [PATCH] [python] Domain-at-create unit-test PR 2/N --- apis/python/tests/test_type_system.py | 21 +++++++++++++-------- apis/python/tests/test_unicode.py | 1 + 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/apis/python/tests/test_type_system.py b/apis/python/tests/test_type_system.py index 9c677dba55..56080e1903 100644 --- a/apis/python/tests/test_type_system.py +++ b/apis/python/tests/test_type_system.py @@ -135,16 +135,21 @@ def test_bool_arrays(tmp_path, bool_array): ] ) index_column_names = ["soma_joinid"] + + n_data = len(bool_array) + data = { + "soma_joinid": list(range(n_data)), + "b": bool_array, + } + rb = pa.Table.from_pydict(data) + nrb = len(rb) + with soma.DataFrame.create( - tmp_path.as_posix(), schema=schema, index_column_names=index_column_names + tmp_path.as_posix(), + schema=schema, + index_column_names=index_column_names, + domain=[[0, max(nrb, 1) - 1]], ) as sdf: - n_data = len(bool_array) - - data = { - "soma_joinid": list(range(n_data)), - "b": bool_array, - } - rb = pa.Table.from_pydict(data) sdf.write(rb) with soma.DataFrame.open(tmp_path.as_posix()) as sdf: diff --git a/apis/python/tests/test_unicode.py b/apis/python/tests/test_unicode.py index 68d252525d..6e2d47bd3c 100644 --- a/apis/python/tests/test_unicode.py +++ b/apis/python/tests/test_unicode.py @@ -46,6 +46,7 @@ def sample_dataframe_path(tmp_path, sample_arrow_table): tmp_path.as_posix(), schema=sample_arrow_table.schema, index_column_names=["soma_joinid"], + domain=((0, len(sample_arrow_table) - 1),), ) as sdf: sdf.write(sample_arrow_table) return sdf.uri