def test_direction_reversed(self, motor : Motor) : self.assertFalse(motor.direction_reversed) switch_limit_left = motor.switch_limit_left switch_limit_right = motor.switch_limit_right motor.position = +1234 motor.direction_reversed = True self.assertTrue(motor.direction_reversed) self.assertIs(motor.switch_limit_left, switch_limit_right) self.assertIs(motor.switch_limit_right, switch_limit_left) self.assertEqual(motor.position, -1234) motor.direction_reversed = False self.assertFalse(motor.direction_reversed) self.assertIs(motor.switch_limit_left, switch_limit_left) self.assertIs(motor.switch_limit_right, switch_limit_right) self.assertEqual(motor.position, +1234)
def test_position(self, motor : Motor) : self.assertEqual(motor.position, 0) position = 100 * motor.number motor.position = position self.assertEqual(motor.position, position)