def test_should_stop_motor(self): motor = Motor(0, 0) motor.turn_left() motor.stop() self.assertEqual(False, motor.pin_a.value) self.assertEqual(False, motor.pin_b.value) self.assertFalse(motor.is_on())
def test_should_turn_Left_and_then_turn_right(self): shoulder = Motor(0, 0) shoulder.turn_right() self.assertEqual(True, shoulder.pin_b.value) self.assertEqual(False, shoulder.pin_a.value) shoulder.turn_left() self.assertEqual(True, shoulder.pin_a.value) self.assertEqual(False, shoulder.pin_b.value) self.assertTrue(shoulder.is_on())
def test_should_turn_left_02_degrees(self): executor = RPiExecutor() motor = Motor(0, 0) control = Control(motor, executor, None) motor.turn_left = MagicMock() motor.stop = MagicMock() executor.move = MagicMock() control.turn_left(10) executor.move.assert_called_with(motor) motor.turn_left.assert_called_with() motor.stop.assert_called_with()