Skip to content

Commit

Permalink
magicbot: Add struct feedback tests
Browse files Browse the repository at this point in the history
  • Loading branch information
auscompgeek committed Jun 23, 2024
1 parent 60b9181 commit e0d63e9
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/test_magicbot_feedback.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,18 @@ def test_collect_feedbacks_with_type_hints():
topic = nt.getTopic(name)
assert topic.getTypeString() == type_str
assert topic.genericSubscribe().get().value() == value

for name, value in [
("type_hinted/rotation", geometry.Rotation2d()),
]:
struct_type = type(value)
assert nt.getTopic(name).getTypeString() == f"struct:{struct_type.__name__}"
topic = nt.getStructTopic(name, struct_type)
assert topic.subscribe(None).get() == value

for name, struct_type, value in (
("type_hinted/rotation_array", geometry.Rotation2d, [geometry.Rotation2d()]),
):
assert nt.getTopic(name).getTypeString() == f"struct:{struct_type.__name__}[]"
topic = nt.getStructArrayTopic(name, struct_type)
assert topic.subscribe([]).get() == value

0 comments on commit e0d63e9

Please sign in to comment.