Skip to content

Commit 8d90817

Browse files
committed
magicbot: Add struct feedback tests
1 parent cd2a9f5 commit 8d90817

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/test_magicbot_feedback.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,18 @@ def test_collect_feedbacks_with_type_hints():
7474
topic = nt.getTopic(name)
7575
assert topic.getTypeString() == type_str
7676
assert topic.genericSubscribe().get().value() == value
77+
78+
for name, value in [
79+
("type_hinted/rotation", geometry.Rotation2d()),
80+
]:
81+
struct_type = type(value)
82+
assert nt.getTopic(name).getTypeString() == f"struct:{struct_type.__name__}"
83+
topic = nt.getStructTopic(name, struct_type)
84+
assert topic.subscribe(None).get() == value
85+
86+
for name, struct_type, value in (
87+
("type_hinted/rotation_array", geometry.Rotation2d, [geometry.Rotation2d()]),
88+
):
89+
assert nt.getTopic(name).getTypeString() == f"struct:{struct_type.__name__}[]"
90+
topic = nt.getStructArrayTopic(name, struct_type)
91+
assert topic.subscribe([]).get() == value

0 commit comments

Comments
 (0)