def test_get_empty_element_available_cell(): """ Check that all the columns are available to insert """ array = [[1, 1, 1, 1, 1, 1, 0], [1, 1, 1, 0, 1, 1, 0], [0, 1, 1, 0, 1, 0, 0], [0, 1, 0, 0, 1, 0, 0], [0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]] board = Board() board.board = array col_0 = 2 col_1 = 5 col_2 = 3 col_3 = 1 col_4 = 4 col_5 = 2 col_6 = 0 # compare with all columns of the board assert (board.get_empty_element(0) == col_0) assert (board.get_empty_element(1) == col_1) assert (board.get_empty_element(2) == col_2) assert (board.get_empty_element(3) == col_3) assert (board.get_empty_element(4) == col_4) assert (board.get_empty_element(5) == col_5) assert (board.get_empty_element(6) == col_6)
def test_get_empty_element_not_available_cell(): """ Check that one o more columns are not available to insert """ array = [[1, 1, 1, 1, 1, 1, 0], [1, 1, 1, 0, 1, 1, 0], [0, 1, 1, 0, 1, 1, 0], [0, 1, 0, 0, 1, 1, 0], [0, 1, 0, 0, 1, 1, 0], [0, 1, 0, 0, 1, 1, 0]] board = Board() board.board = array col_1 = -1 col_4 = -1 col_5 = -1 col_7 = -1 col_8 = -1 # compare with columns that not are available to insert assert (board.get_empty_element(1) == col_1) assert (board.get_empty_element(4) == col_4) assert (board.get_empty_element(5) == col_5) assert (board.get_empty_element(7) == col_7) assert (board.get_empty_element(8) == col_8)