Skip to content

Commit

Permalink
sensor_TEST.py: move PreUpdate callback to Update
Browse files Browse the repository at this point in the history
The test's PreUpdate callback assumes that it executes
after the ForceTorque::PreUpdate, so just move it to
Update to gurantee it. Also fix a spelling error in
the callback variable names.

Signed-off-by: Steve Peters <[email protected]>
  • Loading branch information
scpeters committed Aug 2, 2024
1 parent ba5408f commit 1f76c6a
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions python/test/sensor_TEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ def test_model(self):
def on_post_udpate_cb(_info, _ecm):
self.post_iterations += 1

def on_pre_udpate_cb(_info, _ecm):
self.pre_iterations += 1
def on_update_cb(_info, _ecm):
self.iterations += 1
world_e = world_entity(_ecm)
self.assertNotEqual(K_NULL_ENTITY, world_e)
w = World(world_e)
Expand All @@ -53,19 +53,19 @@ def on_pre_udpate_cb(_info, _ecm):
# Pose Test
self.assertEqual(Pose3d(0, 1, 0, 0, 0, 0), sensor.pose(_ecm))
# Topic Test
if self.pre_iterations <= 1:
if self.iterations <= 1:
self.assertEqual(None, sensor.topic(_ecm))
else:
self.assertEqual('sensor_topic_test', sensor.topic(_ecm))
# Parent Test
self.assertEqual(j.entity(), sensor.parent(_ecm))

def on_udpate_cb(_info, _ecm):
self.iterations += 1
def on_pre_update_cb(_info, _ecm):
self.pre_iterations += 1

fixture.on_post_update(on_post_udpate_cb)
fixture.on_update(on_udpate_cb)
fixture.on_pre_update(on_pre_udpate_cb)
fixture.on_update(on_update_cb)
fixture.on_pre_update(on_pre_update_cb)
fixture.finalize()

server = fixture.server()
Expand Down

0 comments on commit 1f76c6a

Please sign in to comment.