reorder: adapt tests

This commit is contained in:
Robert Sachunsky 2026-07-20 12:32:54 +02:00
parent 5d1fecac87
commit 8d0a9de3e1
2 changed files with 17 additions and 6 deletions

View file

@ -1,21 +1,30 @@
import pytest
from ocrd_modelfactory import page_from_file from ocrd_modelfactory import page_from_file
from ocrd_models.constants import NAMESPACES as NS from ocrd_models.constants import NAMESPACES as NS
@pytest.mark.parametrize(
"options",
[
[], # defaults
["--model_based"],
], ids=str)
def test_run_eynollah_mbreorder_filename( def test_run_eynollah_mbreorder_filename(
tmp_path, tmp_path,
resources_dir, resources_dir,
run_eynollah_ok_and_check_logs, run_eynollah_ok_and_check_logs,
options,
): ):
infile = resources_dir / '2files/kant_aufklaerung_1784_0020.xml' infile = resources_dir / '2files/kant_aufklaerung_1784_0020.xml'
outfile = tmp_path /'kant_aufklaerung_1784_0020.xml' outfile = tmp_path /'kant_aufklaerung_1784_0020.xml'
run_eynollah_ok_and_check_logs( run_eynollah_ok_and_check_logs(
'machine-based-reading-order', 'reorder',
[ [
'-i', str(infile), '-i', str(infile),
'-dim', str(resources_dir / '2files'),
'-o', str(outfile.parent), '-o', str(outfile.parent),
], ] + options,
[ [
# FIXME: mbreorder has no logging! str(infile)
] ]
) )
assert outfile.exists() assert outfile.exists()
@ -34,13 +43,15 @@ def test_run_eynollah_mbreorder_directory(
): ):
outdir = tmp_path outdir = tmp_path
run_eynollah_ok_and_check_logs( run_eynollah_ok_and_check_logs(
'machine-based-reading-order', 'reorder',
[ [
'-di', str(resources_dir / '2files'), '-di', str(resources_dir / '2files'),
'-dim', str(resources_dir / '2files'),
'-o', str(outdir), '-o', str(outdir),
], ],
[ [
# FIXME: mbreorder has no logging! 'Job done in',
'All jobs done in',
] ]
) )
assert len(list(outdir.iterdir())) == 2 assert len(list(outdir.iterdir())) == 2

View file

@ -31,7 +31,7 @@ def eynollah_subcommands():
'layout', 'layout',
'ocr', 'ocr',
'enhancement', 'enhancement',
'machine-based-reading-order', 'reorder',
'models', 'models',
] ]