mirror of
https://github.com/qurator-spk/dinglehopper.git
synced 2025-06-09 11:50:00 +02:00
✔ Test that CLI produces a complete HTML report
This commit is contained in:
parent
a463048a59
commit
9d53c452ec
1 changed files with 23 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
||||||
import json
|
import json
|
||||||
|
import re
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
@ -40,3 +41,25 @@ def test_cli_json_cer_is_infinity(tmp_path):
|
||||||
with open("report.json", "r") as jsonf:
|
with open("report.json", "r") as jsonf:
|
||||||
j = json.load(jsonf)
|
j = json.load(jsonf)
|
||||||
assert j["cer"] == pytest.approx(float("inf"))
|
assert j["cer"] == pytest.approx(float("inf"))
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.integration
|
||||||
|
def test_cli_html(tmp_path):
|
||||||
|
"""Test that the cli/process() yields complete HTML report"""
|
||||||
|
|
||||||
|
with working_directory(tmp_path):
|
||||||
|
with open("gt.txt", "w") as gtf:
|
||||||
|
gtf.write("AAAAA")
|
||||||
|
with open("ocr.txt", "w") as ocrf:
|
||||||
|
ocrf.write("AAAAB")
|
||||||
|
|
||||||
|
process("gt.txt", "ocr.txt", "report")
|
||||||
|
|
||||||
|
with open("report.html", "r") as htmlf:
|
||||||
|
html_report = htmlf.read()
|
||||||
|
print(html_report)
|
||||||
|
|
||||||
|
assert re.search(r"CER: 0\.\d+", html_report)
|
||||||
|
assert re.search(r"WER: 1\.0", html_report)
|
||||||
|
assert len(re.findall("gt.*cdiff", html_report)) == 1
|
||||||
|
assert len(re.findall("gt.*wdiff", html_report)) == 1
|
Loading…
Add table
Add a link
Reference in a new issue