コード例 #1
0
 def test_player_move_fails_wrong_turn(self, board):
     rook_position = Position(1, 1)
     board.get_piece.return_value = Rook(board, constants.BLACK,
                                         rook_position)
     game = Game()
     game._board = board
     game._turn = constants.WHITE
     with pytest.raises(InvalidMoveError):
         game.player_move(rook_position, Position)
コード例 #2
0
def set_up_test_game(board, turn=WHITE, history=None):
    """Helper method sets up a game for testing"""
    game = Game()
    game._board = board
    game._turn = turn
    if history:
        game._history.append(history)
    game.valid_moves = game.get_moves(game.turn)

    return game