mirror of
https://github.com/qurator-spk/dinglehopper.git
synced 2025-06-09 20:00:01 +02:00
💩 dinglehopper: Fix OCR-D CLI test by working around ocrd_cli_wrap_processor() check for arguments
This commit is contained in:
parent
96b55f1806
commit
5bee55c896
1 changed files with 5 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
||||||
import os
|
import os
|
||||||
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
|
||||||
|
@ -23,11 +24,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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue