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

Function test_load_two_distinct_docs

tests/test_parse.py:660–678  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

658
659
660def test_load_two_distinct_docs():
661 filename1 = "tests/data/regression/rotated_text_01.pdf"
662 filename2 = "tests/data/regression/table_of_contents_01.pdf"
663
664 parser = DoclingPdfParser(loglevel="fatal")
665
666 pdf_doc_case1: PdfDocument = parser.load(path_or_stream=filename1, lazy=True)
667
668 pdf_doc_case2: PdfDocument = parser.load(path_or_stream=filename2, lazy=True)
669
670 assert pdf_doc_case1.number_of_pages() != pdf_doc_case2.number_of_pages()
671
672 pdf_doc_case1.load_all_pages()
673 pdf_doc_case2.load_all_pages()
674
675 # The two PdfDocument instances must be non-equal. This confirms
676 # that no internal state is overwritten by accident when loading more than
677 # one document with the same DoclingPdfParser instance.
678 assert pdf_doc_case1._pages != pdf_doc_case2._pages
679
680
681def test_serialize_and_reload():

Callers

nothing calls this directly

Calls 4

loadMethod · 0.95
DoclingPdfParserClass · 0.90
load_all_pagesMethod · 0.80
number_of_pagesMethod · 0.45

Tested by

no test coverage detected