2019-12-10 01:06:27 -08:00
|
|
|
# © 2019 James R. Barlow: github.com/jbarlow83
|
|
|
|
#
|
2020-08-05 00:44:42 -07:00
|
|
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
|
2019-12-10 01:06:27 -08:00
|
|
|
|
2019-12-30 16:37:51 -08:00
|
|
|
import logging
|
|
|
|
|
2019-12-10 01:06:27 -08:00
|
|
|
import pytest
|
|
|
|
|
|
|
|
import ocrmypdf
|
|
|
|
|
2021-04-07 01:56:51 -07:00
|
|
|
from .conftest import check_ocrmypdf
|
2019-12-10 01:06:27 -08:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
|
|
|
def acroform(resources):
|
|
|
|
return resources / 'acroform.pdf'
|
|
|
|
|
|
|
|
|
|
|
|
def test_acroform_and_redo(acroform, caplog, no_outpdf):
|
|
|
|
with pytest.raises(ocrmypdf.exceptions.InputFileError):
|
|
|
|
check_ocrmypdf(acroform, no_outpdf, '--redo-ocr')
|
2019-12-30 16:37:51 -08:00
|
|
|
assert '--redo-ocr is not currently possible' in caplog.text
|
|
|
|
|
|
|
|
|
2020-06-01 03:06:40 -07:00
|
|
|
def test_acroform_message(acroform, caplog, outpdf):
|
2019-12-30 16:37:51 -08:00
|
|
|
caplog.set_level(logging.INFO)
|
2020-06-01 03:06:40 -07:00
|
|
|
check_ocrmypdf(acroform, outpdf, '--plugin', 'tests/plugins/tesseract_noop.py')
|
2019-12-30 16:37:51 -08:00
|
|
|
assert 'fillable form' in caplog.text
|
|
|
|
assert '--force-ocr' in caplog.text
|