mirror of
https://github.com/DS4SD/docling.git
synced 2025-12-08 12:48:28 +00:00
test: avoid testing exact JSON in CSV backend (#1038)
* feat: updated verify_export Moved verify_export to verify_utils Reuse verify_export in tests Signed-off-by: Matheus Abdias <matheusfabdias@gmail.com> * feat: replace verify_export with verify_document in CSV conversion tests Signed-off-by: Matheus Abdias <matheusfabdias@gmail.com> --------- Signed-off-by: Matheus Abdias <matheusfabdias@gmail.com>
This commit is contained in:
@@ -11,7 +11,7 @@ from docling.datamodel.document import (
|
||||
)
|
||||
from docling.document_converter import DocumentConverter
|
||||
|
||||
from .verify_utils import verify_document
|
||||
from .verify_utils import verify_document, verify_export
|
||||
|
||||
GENERATE = False
|
||||
|
||||
@@ -58,22 +58,6 @@ def get_converter():
|
||||
return converter
|
||||
|
||||
|
||||
def verify_export(pred_text: str, gtfile: str):
|
||||
|
||||
if not os.path.exists(gtfile) or GENERATE:
|
||||
with open(gtfile, "w") as fw:
|
||||
fw.write(pred_text)
|
||||
|
||||
return True
|
||||
|
||||
else:
|
||||
with open(gtfile) as fr:
|
||||
true_text = fr.read()
|
||||
|
||||
assert pred_text == true_text, f"pred_text!=true_text for {gtfile}"
|
||||
return pred_text == true_text
|
||||
|
||||
|
||||
def test_e2e_html_conversions():
|
||||
|
||||
html_paths = get_html_paths()
|
||||
|
||||
Reference in New Issue
Block a user