def test_get_possible_numbers_works_properly(indices, expected_numbers): # GIVEN sample_array = np.array([ [1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 2, 0, 0, 0, 0, 0, 0, 1], [0, 0, 3, 0, 0, 0, 0, 0, 0], [0, 0, 0, 4, 0, 0, 0, 0, 0], [0, 0, 0, 0, 5, 8, 0, 0, 0], [0, 0, 0, 0, 0, 6, 0, 0, 0], [0, 0, 0, 0, 0, 0, 8, 0, 0], [0, 0, 0, 0, 0, 0, 0, 7, 0], [0, 0, 0, 0, 0, 0, 0, 0, 9], ]) # WHEN sudoku = Sudoku(sample_array) sudoku.update() indices = sudoku.get_possible_numbers(*indices) # THEN assert np.all(indices == expected_numbers)
def test_get_most_promising_cell_works_properly(): # GIVEN sample_array = np.array([ [1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 2, 0, 0, 0, 0, 0, 0, 1], [0, 0, 3, 0, 0, 0, 0, 0, 0], [0, 0, 0, 4, 0, 0, 0, 0, 0], [0, 0, 0, 0, 5, 8, 0, 0, 0], [0, 0, 0, 0, 0, 6, 0, 0, 0], [0, 0, 0, 0, 0, 0, 8, 0, 0], [0, 0, 0, 0, 0, 0, 0, 7, 0], [0, 0, 0, 0, 0, 0, 0, 0, 9], ]) expected_indices = (1, 5) # WHEN sudoku = Sudoku(sample_array) sudoku.update() indices = sudoku.get_most_promising_cell() # THEN assert indices == expected_indices