File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 11import json
2+ import re
23
34import 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
You can’t perform that action at this time.
0 commit comments