1
0
Fork 0
mirror of https://github.com/qurator-spk/dinglehopper.git synced 2025-06-18 08:09:59 +02:00

💩 dinglehopper: Fix OCR-D CLI test by working around ocrd_cli_wrap_processor() check for arguments

This commit is contained in:
Gerber, Mike 2020-09-25 14:53:19 +02:00
parent 7085ee0fd8
commit da47e41c85

View file

@ -2,6 +2,7 @@ import os
import re import re
import shutil import shutil
import json import json
import sys
from pathlib import Path from pathlib import Path
from click.testing import CliRunner from click.testing import CliRunner
@ -27,11 +28,13 @@ def test_ocrd_cli(tmp_path):
# Run through the OCR-D interface # Run through the OCR-D interface
with working_directory(str(test_workspace_dir)): with working_directory(str(test_workspace_dir)):
runner = CliRunner() runner = CliRunner()
result = runner.invoke(ocrd_dinglehopper, [ args = [
'-m', 'mets.xml', '-m', 'mets.xml',
'-I', 'OCR-D-GT-PAGE,OCR-D-OCR-CALAMARI', '-I', 'OCR-D-GT-PAGE,OCR-D-OCR-CALAMARI',
'-O', 'OCR-D-OCR-CALAMARI-EVAL' '-O', 'OCR-D-OCR-CALAMARI-EVAL'
]) ]
sys.argv[1:] = args # XXX Hack to satisfy ocrd_cli_wrap_processor() check for arguments
result = runner.invoke(ocrd_dinglehopper, args)
assert result.exit_code == 0 assert result.exit_code == 0
result_json = list((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(str(result_json[0])))['cer'] < 0.03 assert json.load(open(str(result_json[0])))['cer'] < 0.03