Skip to content

Commit

Permalink
test: check for stable obj_type (#70)
Browse files Browse the repository at this point in the history
Signed-off-by: Michele Dolfi <[email protected]>
  • Loading branch information
dolfim-ibm authored Sep 11, 2024
1 parent e66dc53 commit 79932b7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/verify_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,14 @@ def verify_maintext(doc_pred: DsDocument, doc_true: DsDocument):
), f"document has different length of main-text than expected. {len(doc_true.main_text)}!={len(doc_pred.main_text)}"

for l, true_item in enumerate(doc_true.main_text):
if isinstance(true_item, BaseText):
pred_item = doc_pred.main_text[l]
pred_item = doc_pred.main_text[l]
# Validate type
assert (
true_item.obj_type == pred_item.obj_type
), f"Item[{l}] type does not match. expected[{true_item.obj_type}] != predicted [{pred_item.obj_type}]"

# Validate text ceels
if isinstance(true_item, BaseText):
assert isinstance(
pred_item, BaseText
), f"{pred_item} is not a BaseText element, but {true_item} is."
Expand Down

0 comments on commit 79932b7

Please sign in to comment.