def test_turn_left__only_changes_facing_direction(): robot = Robot() robot.position = Position(3, 2, Direction.SOUTH) robot.turn_left() assert robot.position == Position(3, 2, Direction.EAST)
def test_robot_has_been_placed(position, want): robot = Robot() robot.position = position got = robot.has_been_placed() assert got == want
def test_move_forward__moves_the_robot_in_its_facing_direction( current_position, new_position, table): robot = Robot() robot.position = current_position table.move_forward(robot) assert robot.position == new_position
def test_move_forward__raises_exception_when_the_next_position_is_off_the_table( current_position, table): robot = Robot() robot.position = deepcopy(current_position) with pytest.raises(InvalidPositionError): table.move_forward(robot) assert robot.position == current_position