Skip to content

Commit 14a20b8

Browse files
committed
Fix mypy: narrow annotation_label after assertIsNotNone in grounding tests
1 parent 819daf2 commit 14a20b8

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

opencontractserver/tests/test_extraction_grounding.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,8 @@ def test_ground_text_document(self):
286286
self.assertEqual(annot.document, self.document)
287287
self.assertEqual(annot.corpus, self.corpus)
288288
self.assertFalse(annot.structural)
289+
self.assertIsNotNone(annot.annotation_label)
290+
assert annot.annotation_label is not None # narrow for mypy
289291
self.assertEqual(annot.annotation_label.text, OC_EXTRACT_SOURCE_LABEL)
290292

291293
# Verify span data
@@ -509,6 +511,8 @@ def test_ground_pdf_creates_token_label_annotations(self):
509511
self.assertEqual(annot.document, self.document)
510512
self.assertEqual(annot.corpus, self.corpus)
511513
self.assertFalse(annot.structural)
514+
self.assertIsNotNone(annot.annotation_label)
515+
assert annot.annotation_label is not None # narrow for mypy
512516
self.assertEqual(annot.annotation_label.text, OC_EXTRACT_SOURCE_LABEL)
513517
# Page must be a positive integer; never the silent default of 1
514518
# for a span that actually lives on page 2.

0 commit comments

Comments
 (0)