diff --git a/tests/test_seqfish.py b/tests/test_seqfish.py new file mode 100644 index 00000000..e0d66655 --- /dev/null +++ b/tests/test_seqfish.py @@ -0,0 +1,27 @@ +import math +from pathlib import Path + +import pytest + +from spatialdata_io.readers.seqfish import seqfish +from tests._utils import skip_if_below_python_version + + +# See https://github.com/scverse/spatialdata-io/blob/main/.github/workflows/prepare_test_data.yaml for instructions on +# how to download and place the data on disk +@skip_if_below_python_version() +@pytest.mark.parametrize("dataset,expected", [("instrument 2 official", "{'y': (0, 108), 'x': (0, 108)}")]) +@pytest.mark.parametrize("rois", [[1], None]) +@pytest.mark.parametrize("cells_as_circles", [False, True]) +def test_example_data(dataset: str, expected: str, rois: list[int] | None, cells_as_circles: bool) -> None: + f = Path("./data") / dataset + assert f.is_dir() + sdata = seqfish(f, cells_as_circles=cells_as_circles, rois=rois) + from spatialdata import get_extent + + extent = get_extent(sdata, exact=False) + extent = {ax: (math.floor(extent[ax][0]), math.ceil(extent[ax][1])) for ax in extent} + if cells_as_circles: + # manual correction required to take into account for the circle radii + expected = "{'y': (-2, 109), 'x': (-2, 109)}" + assert str(extent) == expected diff --git a/tests/test_xenium.py b/tests/test_xenium.py index 2fb35ce1..32408323 100644 --- a/tests/test_xenium.py +++ b/tests/test_xenium.py @@ -40,12 +40,8 @@ def test_roundtrip_with_data_limits() -> None: assert np.array_equal(cell_id_str, f0(*f1(cell_id_str))) -# The datasets should be downloaded from -# https://www.10xgenomics.com/support/software/xenium-onboard-analysis/latest/resources/xenium-example-data#test-data -# and placed in the "data" directory; if you run the tests locally you may need to create a symlink in "tests/data" -# pointing to "data". -# The GitHub workflow "prepare_test_data.yaml" takes care of downloading the datasets and uploading an artifact for the -# tests to use +# See https://github.com/scverse/spatialdata-io/blob/main/.github/workflows/prepare_test_data.yaml for instructions on +# how to download and place the data on disk @skip_if_below_python_version() @pytest.mark.parametrize( "dataset,expected",