Skip to content

Commit

Permalink
Close Scene classes in fixture before re-opening (#3475)
Browse files Browse the repository at this point in the history
  • Loading branch information
jp-dark authored Dec 18, 2024
1 parent da7e337 commit 4fbbebe
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion apis/python/tests/test_experiment_query_spatial.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ def add_scene(

for key, shapes in images.items():
add_multiscale_image(scene, key, shapes)
scene.close()


@pytest.fixture(scope="module")
Expand Down Expand Up @@ -202,7 +203,14 @@ def soma_spatial_experiment(tmp_path_factory) -> soma.Experiment:
scene_ids.flatten().tolist(),
)

return soma.Experiment.open(uri)
exp = soma.Experiment.open(uri)

# Check coordinate spaces.
for index in range(4):
scene = exp.spatial[f"scene{index}"]
assert scene.coordinate_space is not None

return exp


def check_for_scene_data(sdata, has_scenes: List[bool]):
Expand Down Expand Up @@ -271,6 +279,11 @@ def test_spatial_experiment_query_all(soma_spatial_experiment):
# Read to SpatialData.
sdata = query.to_spatialdata("data")

# Check the expected scenes are included.
scene_ids = set(str(val) for val in query.obs_scene_ids())
expected_scene_ids = {"scene0", "scene1", "scene2", "scene3"}
assert scene_ids == expected_scene_ids

# Verify the correct number of assets.
assert len(sdata.tables) == 1
assert len(sdata.points) == 8
Expand Down

0 comments on commit 4fbbebe

Please sign in to comment.