replaced deprecated json function with model_dump_json

Signed-off-by: Peter Staar <taa@zurich.ibm.com>
This commit is contained in:
Peter Staar 2024-08-26 20:38:42 +02:00
parent 08364dfa56
commit 35bd7b9cff

View File

@ -84,11 +84,12 @@ def test_conversions():
for path in pdf_paths: for path in pdf_paths:
print(f"converting {path}")
doc_pred_json = None doc_pred_json = None
doc_true_json = None doc_true_json = None
try: try:
# print(f"converting {path}")
doc_pred_json = converter.convert_single(path) doc_pred_json = converter.convert_single(path)
except: except:
continue continue
@ -114,11 +115,11 @@ def test_conversions():
with open(md_path, "r") as fr: with open(md_path, "r") as fr:
doc_true_md = "".join(fr.readlines()) doc_true_md = "".join(fr.readlines())
doc_ = json.loads(doc_pred_json.model_dump_json()) #doc_ = json.loads(doc_pred_json.model_dump_json())
# print(json.dumps(doc_, indent=2)) # print(json.dumps(doc_, indent=2))
assert verify_json( assert verify_json(
doc_, doc_true_json doc_pred_json.model_dump(), doc_true_json
), f"failed json prediction for {path}" ), f"failed json prediction for {path}"
assert verify_md( assert verify_md(