Skip to content

Commit

Permalink
Add value check for ROSTimeDicting
Browse files Browse the repository at this point in the history
  • Loading branch information
liambenson authored Mar 3, 2022
1 parent b42369b commit 334bad3
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions test/embag_test_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,14 @@ def testDictUnpacking(self):
def testROSTimeDicting(self):
for msg in self.view.getMessages('/base_pose_ground_truth'):
assert isinstance(msg.dict()['header']['stamp'], embag.RosTime)
assert isinstance(msg.dict(ros_time_py_type=None)['header']['stamp'], embag.RosTime)
assert isinstance(msg.dict(ros_time_py_type=int)['header']['stamp'], int)
assert isinstance(msg.dict(ros_time_py_type=float)['header']['stamp'], float)
as_ros_time = msg.dict(ros_time_py_type=None)['header']['stamp']
as_int = msg.dict(ros_time_py_type=int)['header']['stamp']
as_float = msg.dict(ros_time_py_type=float)['header']['stamp']
assert isinstance(as_ros_time, embag.RosTime)
assert isinstance(as_int, int)
assert isinstance(as_float, float)
assert as_ros_time.to_nsec() == as_int
assert as_ros_time.to_sec() == as_float

if __name__ == "__main__":
unittest.main()

0 comments on commit 334bad3

Please sign in to comment.