def test_clear_cell_not_exist(): """ Check that the board not change with value out the range """ array = [[1, 1, 1, 2, 1, 0, 0], [2, 1, 1, 1, 2, 0, 0], [0, 0, 1, 1, 2, 0, 0], [0, 0, 2, 2, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]] board = Board() board.set_board(array) position_test = [9, 9] # out the range of board # try to clear cell board.clear_cell(position_test[0], position_test[0]) assert (array == board.board)
def test_clear_cell_exist(): """ Check that cell is clear correctly """ array = [[1, 1, 1, 2, 1, 0, 0], [2, 1, 1, 1, 2, 0, 0], [0, 0, 1, 1, 2, 0, 0], [0, 0, 2, 2, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]] board = Board() board.set_board(array) position_test = [0, 0] # at the begin of array # update position in array to compare array[position_test[0]][position_test[1]] = board.null_cell board.clear_cell(position_test[0], position_test[0]) assert (array == board.board)