Skip to content

Commit

Permalink
Test overwrite-related behavior in cellpose task (ref #458)
Browse files Browse the repository at this point in the history
  • Loading branch information
tcompa committed Aug 30, 2023
1 parent ed8e5cd commit 5c6688c
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/tasks/test_workflows_cellpose_segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
from ._validation import validate_schema
from .lib_empty_ROI_table import _add_empty_ROI_table
from fractal_tasks_core.lib_input_models import Channel
from fractal_tasks_core.lib_zarr import OverwriteNotAllowedError
from fractal_tasks_core.tasks.cellpose_segmentation import (
cellpose_segmentation,
)
Expand Down Expand Up @@ -510,6 +511,37 @@ def test_workflow_bounding_box(
output_ROI_table="bbox_table",
)

# Re-run with overwrite=True
for component in metadata["image"]:
cellpose_segmentation(
input_paths=[str(zarr_path)],
output_path=str(zarr_path),
metadata=metadata,
component=component,
channel=Channel(wavelength_id="A01_C01"),
level=3,
relabeling=True,
diameter_level0=80.0,
output_ROI_table="bbox_table",
overwrite=True,
)

# Re-run with overwrite=False
with pytest.raises(OverwriteNotAllowedError):
for component in metadata["image"]:
cellpose_segmentation(
input_paths=[str(zarr_path)],
output_path=str(zarr_path),
metadata=metadata,
component=component,
channel=Channel(wavelength_id="A01_C01"),
level=3,
relabeling=True,
diameter_level0=80.0,
output_ROI_table="bbox_table",
overwrite=False,
)

bbox_ROIs = ad.read_zarr(
str(zarr_path / metadata["image"][0] / "tables/bbox_table/")
)
Expand Down

0 comments on commit 5c6688c

Please sign in to comment.