def is_occupied(row_index, col_index, game_board): """ (int, int, str) -> int Precondition: row_index and col_index are valid indices for a cell in the tic-tac-toe game_board. Return True if and only if the cell with indices row_index and col_index in the tic-tac-toe game_board does not contain the EMPTY cell character. >>> is_occupied(1, 1, 'XOX-') True >>> is_occupied(2, 2, 'XOX-') False """ board_size = tictactoe_functions.get_board_size(game_board) position = tictactoe_functions.get_position(row_index, col_index, board_size) return game_board[position] != tictactoe_functions.EMPTY
'returned {0} .'.format(type(result)) assert result == 1, \ "tictactoe_functions.get_board_size('-') should return 1, but "\ 'returned {0}.'.format(result) # Type check and simple test for tictactoe_functions.make_empty_board result = tictactoe_functions.make_empty_board(1) assert isinstance(result, str), \ 'tictactoe_functions.make_empty_board should return a str, but ' \ 'returned {0}.'.format(type(result)) assert result == constant_before[0], \ "tictactoe_functions.make_empty_board(1) should return '" \ + constant_before[0] + "', but returned '{0}'.".format(result) # Type check and simple test for tictactoe_functions.get_position result = tictactoe_functions.get_position(1, 1, 3) assert isinstance(result, int), \ 'tictactoe_functions.get_position should return an int, but returned ' \ '{0}.'.format(type(result)) assert result == 0, \ 'tictactoe_functions.get_position(1, 1, 3) should return 0, but ' \ 'returned {0}.'.format(result) # Type check and simple test for tictactoe_functions.make_move result = tictactoe_functions.make_move('X', 1, 1, '-') assert isinstance(result, str), \ 'tictactoe_functions.make_move should return a str, but returned {0}.' \ .format(type(result)) assert result == 'X', \ "tictactoe_functions.make_move('X', 1, 1, '-') should return 'X', "\ "but returned '{0}'.".format(result)