Skip to content

Commit

Permalink
Python-side code-review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
johnkerl committed Nov 6, 2024
1 parent 0f4f525 commit b7c72df
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
10 changes: 6 additions & 4 deletions apis/python/src/tiledbsoma/_dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,13 +298,15 @@ def create(
)

if index_column_name == "soma_joinid":
if slot_core_current_domain[0] != 0:
lower = slot_core_current_domain[0]
upper = slot_core_current_domain[1]
if lower != 0:
raise ValueError(
f"domain for soma_joinid must have lower bound of 0; got {slot_core_current_domain[0]}"
f"domain for soma_joinid must have lower bound of 0; got {lower}"
)
if slot_core_max_domain[0] != 0:
if upper < 0:
raise ValueError(

Check warning on line 308 in apis/python/src/tiledbsoma/_dataframe.py

View check run for this annotation

Codecov / codecov/patch

apis/python/src/tiledbsoma/_dataframe.py#L308

Added line #L308 was not covered by tests
f"maxdomain for soma_joinid must have lower bound of 0; got {slot_core_max_domain[0]}"
f"domain for soma_joinid must have upper bound >= 0; got {upper}"
)

# Here is our Arrow data API for communicating schema info between
Expand Down
9 changes: 8 additions & 1 deletion apis/python/tests/test_dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -1871,7 +1871,7 @@ def test_presence_matrix(tmp_path):
assert actual.equals(df)


def test_lower_bound_on_somajoinid_domain(tmp_path):
def test_bounds_on_somajoinid_domain(tmp_path):
uri = tmp_path.as_posix()

schema = pa.schema(
Expand All @@ -1890,6 +1890,13 @@ def test_lower_bound_on_somajoinid_domain(tmp_path):
domain=[[2, 99]],
)

with pytest.raises(ValueError):
soma.DataFrame.create(
uri,
schema=schema,
domain=[[0, -1]],
)

soma.DataFrame.create(
uri,
schema=schema,
Expand Down

0 comments on commit b7c72df

Please sign in to comment.