MCPcopy Create free account
hub / github.com/docling-project/docling-parse / test_get_annotations

Function test_get_annotations

tests/test_parse.py:887–909  ·  view source on GitHub ↗

Test accessing document annotations.

()

Source from the content-addressed store, hash-verified

885
886
887def test_get_annotations():
888 """Test accessing document annotations."""
889 parser = DoclingPdfParser(loglevel="fatal")
890
891 # Test with form_fields.pdf which has annotations
892 pdf_doc = parser.load(
893 path_or_stream="tests/data/regression/form_fields.pdf", lazy=True
894 )
895
896 annotations = pdf_doc.get_annotations()
897
898 assert annotations is not None
899 assert annotations.form is not None or annotations.form is None
900
901 # form_fields.pdf has form data
902 if annotations.form is not None:
903 assert isinstance(annotations.form, dict)
904
905 # Test caching
906 annotations2 = pdf_doc.get_annotations()
907 assert annotations is annotations2 # Should return cached instance
908
909 pdf_doc.unload()
910
911
912def verify_annotations_recursive(true_annots, pred_annots):

Callers

nothing calls this directly

Calls 4

loadMethod · 0.95
DoclingPdfParserClass · 0.90
get_annotationsMethod · 0.45
unloadMethod · 0.45

Tested by

no test coverage detected