How to use the ocrmypdf._validation.check_options_output function in ocrmypdf

To help you get started, we’ve selected a few ocrmypdf examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jbarlow83 / OCRmyPDF / tests / test_validation.py View on Github external
def test_old_ghostscript(caplog):
    with patch('ocrmypdf.exec.ghostscript.version', return_value='9.19'), patch(
        'ocrmypdf.exec.tesseract.has_textonly_pdf', return_value=True
    ):
        vd.check_options_output(make_opts(language='chi_sim', output_type='pdfa'))
        assert 'Ghostscript does not work correctly' in caplog.text

    with patch('ocrmypdf.exec.ghostscript.version', return_value='9.18'), patch(
        'ocrmypdf.exec.tesseract.has_textonly_pdf', return_value=True
    ):
        with pytest.raises(MissingDependencyError):
            vd.check_options_output(make_opts(output_type='pdfa-3'))

    with patch('ocrmypdf.exec.ghostscript.version', return_value='9.24'), patch(
        'ocrmypdf.exec.tesseract.has_textonly_pdf', return_value=True
    ):
        with pytest.raises(MissingDependencyError):
            vd.check_dependency_versions(make_opts())
github jbarlow83 / OCRmyPDF / tests / test_validation.py View on Github external
def test_old_tesseract_error():
    with patch('ocrmypdf.exec.tesseract.has_textonly_pdf', return_value=False):
        with pytest.raises(MissingDependencyError):
            opts = make_opts(pdf_renderer='sandwich', language='eng')
            vd.check_options_output(opts)
github jbarlow83 / OCRmyPDF / tests / test_validation.py View on Github external
def test_lossless_redo():
    with pytest.raises(BadArgsError):
        vd.check_options_output(make_opts(redo_ocr=True, deskew=True))
github jbarlow83 / OCRmyPDF / tests / test_validation.py View on Github external
def test_old_ghostscript(caplog):
    with patch('ocrmypdf.exec.ghostscript.version', return_value='9.19'), patch(
        'ocrmypdf.exec.tesseract.has_textonly_pdf', return_value=True
    ):
        vd.check_options_output(make_opts(language='chi_sim', output_type='pdfa'))
        assert 'Ghostscript does not work correctly' in caplog.text

    with patch('ocrmypdf.exec.ghostscript.version', return_value='9.18'), patch(
        'ocrmypdf.exec.tesseract.has_textonly_pdf', return_value=True
    ):
        with pytest.raises(MissingDependencyError):
            vd.check_options_output(make_opts(output_type='pdfa-3'))

    with patch('ocrmypdf.exec.ghostscript.version', return_value='9.24'), patch(
        'ocrmypdf.exec.tesseract.has_textonly_pdf', return_value=True
    ):
        with pytest.raises(MissingDependencyError):
            vd.check_dependency_versions(make_opts())
github jbarlow83 / OCRmyPDF / tests / test_validation.py View on Github external
def test_hocr_notlatin_warning(caplog):
    vd.check_options_output(make_opts(language='chi_sim', pdf_renderer='hocr'))
    assert 'PDF renderer is known to cause' in caplog.text