diff --git a/python-spec/src/somacore/coordinates.py b/python-spec/src/somacore/coordinates.py index 3f09ef6..2703cb2 100644 --- a/python-spec/src/somacore/coordinates.py +++ b/python-spec/src/somacore/coordinates.py @@ -35,7 +35,7 @@ class CoordinateSpace(collections.abc.Sequence[Axis]): Lifecycle: experimental """ - axes: Tuple[Axis] = attrs.field(converter=tuple) + axes: Tuple[Axis, ...] = attrs.field(converter=tuple) @axes.validator def _validate(self, _, axes: Tuple[Axis, ...]) -> None: diff --git a/python-spec/testing/test_coordinates.py b/python-spec/testing/test_coordinates.py index 96e80cc..1bccb8a 100644 --- a/python-spec/testing/test_coordinates.py +++ b/python-spec/testing/test_coordinates.py @@ -2,6 +2,8 @@ import pytest from somacore import AffineTransform +from somacore import Axis +from somacore import CoordinateSpace from somacore import CoordinateTransform from somacore import IdentityTransform from somacore import ScaleTransform @@ -28,6 +30,15 @@ def check_transform_is_equal( assert False +def test_coordinate_space(): + coord_space = CoordinateSpace( + (Axis("x", unit="nanometer"), Axis("y", unit="nanometer")) # type: ignore[arg-type] + ) + assert len(coord_space) == 2 + assert coord_space.axis_names == ("x", "y") + assert coord_space[0] == Axis("x", unit="nanometer") + + @pytest.mark.parametrize( ("input", "expected"), [