Skip to content

Commit

Permalink
Fix type hint for CoordinateSpace axis (#228)
Browse files Browse the repository at this point in the history
  • Loading branch information
jp-dark authored Sep 24, 2024
1 parent e71c15d commit eb60084
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion python-spec/src/somacore/coordinates.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
11 changes: 11 additions & 0 deletions python-spec/testing/test_coordinates.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"),
[
Expand Down

0 comments on commit eb60084

Please sign in to comment.