Standardize tesseract.generate_hocr and _pdf parameters
This commit is contained in:
@@ -241,7 +241,6 @@ def run_ocrmypdf_api(input_file, output_file, *args, env=None):
|
||||
[str(input_file), str(output_file)]
|
||||
+ [str(arg) for arg in args if arg is not None]
|
||||
)
|
||||
|
||||
if env:
|
||||
options.tesseract_env = env.copy()
|
||||
options.tesseract_env['_OCRMYPDF_TEST_INFILE'] = os.fspath(input_file)
|
||||
|
||||
+1
-1
@@ -233,7 +233,7 @@ def test_german(spoof_tesseract_cache, resources, outdir):
|
||||
env=spoof_tesseract_cache,
|
||||
)
|
||||
except MissingDependencyError:
|
||||
if 'deu' not in tesseract.languages():
|
||||
if 'deu' not in tesseract.get_languages():
|
||||
pytest.xfail(reason="tesseract-deu language pack not installed")
|
||||
raise
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ def test_no_languages(tmp_path):
|
||||
env['TESSDATA_PREFIX'] = fspath(tmp_path)
|
||||
|
||||
with pytest.raises(MissingDependencyError):
|
||||
tesseract.languages(tesseract_env=env)
|
||||
tesseract.get_languages(tesseract_env=env)
|
||||
|
||||
|
||||
def test_image_too_large_hocr(monkeypatch, resources, outdir):
|
||||
@@ -88,8 +88,8 @@ def test_image_too_large_hocr(monkeypatch, resources, outdir):
|
||||
tesseract.generate_hocr(
|
||||
input_file=resources / 'crom.png',
|
||||
output_hocr=outdir / 'out.hocr',
|
||||
output_sidecar=outdir / 'out.txt',
|
||||
language=['eng'],
|
||||
output_text=outdir / 'out.txt',
|
||||
languages=['eng'],
|
||||
engine_mode=None,
|
||||
tessconfig=[],
|
||||
timeout=180.0,
|
||||
@@ -107,10 +107,10 @@ def test_image_too_large_pdf(monkeypatch, resources, outdir):
|
||||
|
||||
monkeypatch.setattr(tesseract, 'run', dummy_run)
|
||||
tesseract.generate_pdf(
|
||||
input_image=resources / 'crom.png',
|
||||
input_file=resources / 'crom.png',
|
||||
output_pdf=outdir / 'pdf.pdf',
|
||||
output_text=outdir / 'txt.txt',
|
||||
language=['eng'],
|
||||
languages=['eng'],
|
||||
engine_mode=None,
|
||||
tessconfig=[],
|
||||
timeout=180.0,
|
||||
|
||||
Reference in New Issue
Block a user