Exemplo n.º 1
0
def test_load_sample_sudoku_raises_error_if_wrong_probe_is_inputted():
    # GIVEN
    wrong_probe_number = 101

    # GIVEN
    with pytest.raises(FileNotFoundError):
        load_sample_unsolved_sudoku(wrong_probe_number)
Exemplo n.º 2
0
def test_recursive_solver_works_for_simples_cases(probe):
    # GIVEN
    sudoku = Sudoku(load_sample_unsolved_sudoku(probe))

    # WHEN
    solved_sudoku = recursive_solver(sudoku)

    # THEN
    assert solved_sudoku.is_solved == True
    assert sudoku_is_valid(solved_sudoku.array) == True
Exemplo n.º 3
0
def test_draw_sudoku_works_properly_for_nonsolved_sudokus(probe):
    # GIVEN
    sample_path = f"./tests/app/images/sample_{probe}.png"
    sudoku = Sudoku(load_sample_unsolved_sudoku(probe))
    expected_suffix = ".png"

    # WHEN
    draw_sudoku(sudoku=sudoku, path=sample_path)

    # THEN
    assert Path(sample_path).suffix == expected_suffix

    # cleaning up!
    remove(sample_path)
Exemplo n.º 4
0
def test_load_sample_sudoku_returns_proper_array(probe):
    # GIVEN & WHEN
    sudoku_array = load_sample_unsolved_sudoku(probe)

    # THEN
    assert type(sudoku_array) == np.ndarray