diff --git a/src/linkerbot_hand/capabilities/types.py b/src/linkerbot_hand/capabilities/types.py index 9e29670..df7ae02 100644 --- a/src/linkerbot_hand/capabilities/types.py +++ b/src/linkerbot_hand/capabilities/types.py @@ -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, ) @@ -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, ) diff --git a/tests/hand/api_v1/test_capabilities_and_conversion.py b/tests/hand/api_v1/test_capabilities_and_conversion.py index d1d4091..0610eeb 100644 --- a/tests/hand/api_v1/test_capabilities_and_conversion.py +++ b/tests/hand/api_v1/test_capabilities_and_conversion.py @@ -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"), (