fix(iphone): topology decode return type + test
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user