Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/linkerbot_hand/capabilities/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ def command(self, semantic: CommandSemantic) -> CommandCapability | None:
"""Look up writable metadata without device I/O."""

return next(
(value for value in self.commands if value.semantic is semantic),
(value for value in self.commands if value.semantic == semantic),
None,
)

Expand All @@ -332,7 +332,7 @@ def telemetry_channel(
"""Look up readable/cache metadata without device I/O."""

return next(
(value for value in self.telemetry if value.semantic is semantic),
(value for value in self.telemetry if value.semantic == semantic),
None,
)

Expand Down
7 changes: 7 additions & 0 deletions tests/hand/api_v1/test_capabilities_and_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ def test_supported_model_names_are_canonical_and_stable() -> None:
)


def test_capability_lookup_accepts_equivalent_string_semantics() -> None:
capabilities = get_declared_capabilities("l6", side="left")

assert capabilities.command("angles") is not None # ty: ignore[invalid-argument-type]
assert capabilities.telemetry_channel("angles") is not None # ty: ignore[invalid-argument-type]


@pytest.mark.parametrize(
("model", "canonical"),
(
Expand Down