Skip to content

Commit

Permalink
add testing
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzocerrone committed Dec 16, 2024
1 parent 63bf566 commit 27a1e28
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,10 @@ pretty = true
[tool.pytest.ini_options]
minversion = "7.0"
testpaths = ["tests"]
filterwarnings = ["error"]
filterwarnings = [
"error",
"ignore::FutureWarning", # TODO remove after zarr-python v3
]
addopts = [
"-vv",
"--color=yes",
Expand Down
2 changes: 1 addition & 1 deletion src/ngio/core/ngff_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ def derive_new_image(
new_image = NgffImage(store=store)

if copy_tables:
# TODO: to be refactored when the label location is changed in the spec
# TODO: to be refactored when the table location is changed in the spec
source_tables_group = self.tables._table_group

if source_tables_group is None:
Expand Down
19 changes: 19 additions & 0 deletions tests/core/test_ngff_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,22 @@ def test_ngff_image(self, ome_zarr_image_v04_path: Path) -> None:
)

new_ngff_image.update_omero_window(start_percentile=1.1, end_percentile=98.9)

def test_ngff_image_derive(self, ome_zarr_image_v04_path: Path) -> None:
from ngio.core.ngff_image import NgffImage

ngff_image = NgffImage(ome_zarr_image_v04_path)

for name, table_type in [("test_roi", "roi_table")]:
table = ngff_image.tables.new(name=name, table_type=table_type)
table.consolidate()

ngff_image.labels.derive("test_label")

new_path = ome_zarr_image_v04_path.parent / "new_ngff_image.zarr"
new_ngff_image = ngff_image.derive_new_image(
new_path, "new_image", overwrite=True, copy_labels=True, copy_tables=True
)

assert ngff_image.tables.list() == new_ngff_image.tables.list()
assert ngff_image.labels.list() == new_ngff_image.labels.list()

0 comments on commit 27a1e28

Please sign in to comment.