1
0
Fork 0
mirror of https://github.com/qurator-spk/dinglehopper.git synced 2025-06-08 11:20:26 +02:00
This commit is contained in:
JKamlah 2019-10-31 12:16:22 +01:00
commit c9cfdc59ae

View file

@ -29,13 +29,15 @@ class working_directory:
def test_ocrd_cli(tmp_path): def test_ocrd_cli(tmp_path):
"""Test OCR-D interface""" """Test OCR-D interface"""
# XXX Path.str() is necessary for Python 3.5
# Copy test workspace # Copy test workspace
test_workspace_dir_source = Path(data_dir) / 'actevedef_718448162' test_workspace_dir_source = Path(data_dir) / 'actevedef_718448162'
test_workspace_dir = tmp_path / 'test_ocrd_cli' test_workspace_dir = tmp_path / 'test_ocrd_cli'
shutil.copytree(test_workspace_dir_source, test_workspace_dir) shutil.copytree(str(test_workspace_dir_source), str(test_workspace_dir))
# Run through the OCR-D interface # Run through the OCR-D interface
with working_directory(test_workspace_dir): with working_directory(str(test_workspace_dir)):
runner = CliRunner() runner = CliRunner()
result = runner.invoke(ocrd_dinglehopper, [ result = runner.invoke(ocrd_dinglehopper, [
'-m', 'mets.xml', '-m', 'mets.xml',
@ -43,5 +45,5 @@ def test_ocrd_cli(tmp_path):
'-O', 'OCR-D-OCR-CALAMARI-EVAL' '-O', 'OCR-D-OCR-CALAMARI-EVAL'
]) ])
assert result.exit_code == 0 assert result.exit_code == 0
result_json = list((Path(test_workspace_dir) / 'OCR-D-OCR-CALAMARI-EVAL').glob('*.json')) result_json = list((test_workspace_dir / 'OCR-D-OCR-CALAMARI-EVAL').glob('*.json'))
assert json.load(open(result_json[0]))['cer'] < 0.03 assert json.load(open(str(result_json[0])))['cer'] < 0.03