Skip to content

Commit 480b3cf

Browse files
committed
✔ Test that CLI produces a complete HTML report
1 parent f1a586c commit 480b3cf

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/dinglehopper/tests/test_integ_cli_valid_json.py renamed to src/dinglehopper/tests/test_integ_cli_valid_report.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import json
2+
import re
23

34
import pytest
45

@@ -40,3 +41,25 @@ def test_cli_json_cer_is_infinity(tmp_path):
4041
with open("report.json", "r") as jsonf:
4142
j = json.load(jsonf)
4243
assert j["cer"] == pytest.approx(float("inf"))
44+
45+
46+
@pytest.mark.integration
47+
def test_cli_html(tmp_path):
48+
"""Test that the cli/process() yields complete HTML report"""
49+
50+
with working_directory(tmp_path):
51+
with open("gt.txt", "w") as gtf:
52+
gtf.write("AAAAA")
53+
with open("ocr.txt", "w") as ocrf:
54+
ocrf.write("AAAAB")
55+
56+
process("gt.txt", "ocr.txt", "report")
57+
58+
with open("report.html", "r") as htmlf:
59+
html_report = htmlf.read()
60+
print(html_report)
61+
62+
assert re.search(r"CER: 0\.\d+", html_report)
63+
assert re.search(r"WER: 1\.0", html_report)
64+
assert len(re.findall("gt.*cdiff", html_report)) == 1
65+
assert len(re.findall("gt.*wdiff", html_report)) == 1

0 commit comments

Comments
 (0)