Esempio n. 1
0
 def test_get_torque(self):
     """Test set_torque method with none input."""
     _ = self.motor.torque
     sent_messages = []
     while not self.send_q.empty():
         sent_messages.append(self.send_q.get_nowait())
     self.assertTrue(
         Motor.request_property(-1, Motor.PropertyType.FIRST_TORQUE) in
         sent_messages
     )
     self.assertTrue(
         Motor.request_property(-1, Motor.PropertyType.SECOND_TORQUE) in
         sent_messages
     )
Esempio n. 2
0
 def test_get_speed(self):
     """Test get_speed method with none input."""
     _ = self.motor.speed
     sent_messages = []
     while not self.send_q.empty():
         sent_messages.append(self.send_q.get_nowait())
     self.assertTrue(
         Motor.request_property(-1, Motor.PropertyType.FIRST_SPEED) in
         sent_messages
     )
     self.assertTrue(
         Motor.request_property(-1, Motor.PropertyType.SECOND_SPEED) in
         sent_messages
     )
Esempio n. 3
0
 def test_get_second_degree(self):
     """Test get_second_degree method"""
     _ = self.motor.second_degree
     sent_messages = []
     while not self.send_q.empty():
         sent_messages.append(self.send_q.get_nowait())
     self.assertTrue(
         Motor.request_property(-1, Motor.PropertyType.SECOND_DEGREE) in
         sent_messages
     )
Esempio n. 4
0
 def test_set_torque(self):
     """Test set_torque method."""
     expected_values = first_torque_value, second_torque_value = 50, 50
     self.motor.torque = expected_values
     sent_messages = []
     while not self.send_q.empty():
         sent_messages.append(self.send_q.get_nowait())
     self.assertTrue(
         Motor.request_property(
             -1, Motor.PropertyType.FIRST_TORQUE) in sent_messages)
     self.assertTrue(
         Motor.request_property(
             -1, Motor.PropertyType.SECOND_TORQUE) in sent_messages)
     self.assertTrue(
         parse_message(0x04, 19, -1, parse_data(
             (0, 0, first_torque_value), 'int'
         )) in sent_messages)
     self.assertTrue(
         parse_message(0x04, 19, -1, parse_data(
             (1, 0, second_torque_value), 'int'
         )) in sent_messages)
Esempio n. 5
0
 def test_set_second_degree(self):
     """Test set_second_degree method."""
     second_degree_value = 50
     self.motor.second_degree = second_degree_value
     sent_messages = []
     while not self.send_q.empty():
         sent_messages.append(self.send_q.get_nowait())
     self.assertTrue(
         Motor.request_property(
             -1, Motor.PropertyType.SECOND_DEGREE) in sent_messages)
     self.assertTrue(
         parse_message(0x04, 19, -1, parse_data(
             (1, 2, second_degree_value), 'int'
         )) in sent_messages)
Esempio n. 6
0
 def test_set_first_speed(self):
     """Test set_first_speed method."""
     first_speed_value = 50
     self.motor.first_speed = first_speed_value
     sent_messages = []
     while not self.send_q.empty():
         sent_messages.append(self.send_q.get_nowait())
     self.assertTrue(
         Motor.request_property(
             -1, Motor.PropertyType.FIRST_SPEED) in sent_messages)
     self.assertTrue(
         parse_message(0x04, 19, -1, parse_data(
             (0, 1, first_speed_value), 'int'
         )) in sent_messages)