fix(iphone): topology decode return type + test

This commit is contained in:
clement
2026-06-30 22:02:35 +02:00
parent fbc8b55044
commit b00b6dfbda
2 changed files with 6 additions and 1 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ def encode_topology(names: list[str], parents: list[int]) -> bytes:
return bytes(out)
def decode_topology(payload: bytes):
def decode_topology(payload: bytes) -> tuple[list[str], list[int]] | None:
"""Return (joint_names, parents) or None if malformed."""
if len(payload) < 2:
return None
@@ -26,3 +26,8 @@ def test_rejects_truncated():
def test_rejects_too_short():
assert decode_topology(b"\x00") is None
def test_rejects_truncated_parents():
# 1 joint "a", parents section missing.
assert decode_topology(b"\x00\x01\x01a") is None