Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/spatialdata/_core/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ def check_all_keys_case_insensitively_unique(keys: Collection[str], location: tu
exc_type=ValueError,
) as collect_error:
for key in keys:
if key is None:
continue
normalized_key = key.lower()
with collect_error(location=location + (key,)):
check_key_is_case_insensitively_unique(key, seen)
Expand Down Expand Up @@ -247,6 +249,8 @@ def validate_table_attr_keys(data: AnnData, location: tuple[str, ...] = ()) -> N
with collect_error(location=attr_path):
check_all_keys_case_insensitively_unique(getattr(data, attr).keys(), location=attr_path)
for key in getattr(data, attr):
if key is None:
continue
key_path = attr_path + (key,)
with collect_error(location=key_path):
if attr in ("obs", "var"):
Expand Down
2 changes: 1 addition & 1 deletion tests/io/test_multi_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def test_null_values_in_instance_key_column(self, full_sdata: SpatialData):
n_obs = full_sdata["table"].n_obs
full_sdata["table"].obs["instance_id"] = range(n_obs)
# introduce null values
full_sdata["table"].obs.loc[0, "instance_id"] = None
full_sdata["table"].obs.at[full_sdata["table"].obs_names[0], "instance_id"] = None
with pytest.raises(ValueError, match="must not contain null values, but it does."):
full_sdata.validate_table_in_spatialdata(table=full_sdata["table"])

Expand Down
Loading