コード例 #1
0
    def _move_turtle(self, action: Action):
        turtle = self._find_turtle(action.get_color())
        if action.does_move_last_turtle() and not self.board.is_last(turtle):
            raise ValueError('Arrow card can move only the last turtle.' +
                             f'Turtle {turtle} is not one of the last turtles')

        self.board.move(turtle, action.get_offset())
コード例 #2
0
def test_does_move_last_turtle_should_return_false_when_card_symbol_is_plus():
    action = Action(Card(0, 'RAINBOW', 'PLUS'), 'RED')

    actual = action.does_move_last_turtle()

    assert not actual
コード例 #3
0
def test_does_move_last_turtle_returns_true_when_card_symbol_is_arrow_arrow():
    action = Action(Card(0, 'RAINBOW', 'ARROW_ARROW'), 'RED')

    actual = action.does_move_last_turtle()

    assert actual