feat: adapt actuation receiver to state's qi_session
Makes actuation tests pass. In main, the timing of the socket no longer contains the time to receive and send data, but only the processing time of the message handler. ref: N25B-168
This commit is contained in:
40
test/unit/test_time_block.py
Normal file
40
test/unit/test_time_block.py
Normal file
@@ -0,0 +1,40 @@
|
||||
import unittest
|
||||
|
||||
import mock
|
||||
|
||||
from robot_interface.utils.timeblock import TimeBlock
|
||||
|
||||
|
||||
class AnyFloat(object):
|
||||
def __eq__(self, other):
|
||||
return isinstance(other, float)
|
||||
|
||||
|
||||
class TestTimeBlock(unittest.TestCase):
|
||||
def test_no_limit(self):
|
||||
callback = mock.Mock()
|
||||
|
||||
with TimeBlock(callback):
|
||||
pass
|
||||
|
||||
callback.assert_called_once_with(AnyFloat())
|
||||
|
||||
def test_exceed_limit(self):
|
||||
callback = mock.Mock()
|
||||
|
||||
with TimeBlock(callback, 0):
|
||||
pass
|
||||
|
||||
callback.assert_called_once_with(AnyFloat())
|
||||
|
||||
def test_within_limit(self):
|
||||
callback = mock.Mock()
|
||||
|
||||
with TimeBlock(callback, 5):
|
||||
pass
|
||||
|
||||
callback.assert_not_called()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user