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

Function test_load_from_bytesio_eager

tests/test_parse.py:725–747  ·  view source on GitHub ↗

Test loading PDF from BytesIO with lazy=False.

()

Source from the content-addressed store, hash-verified

723
724
725def test_load_from_bytesio_eager():
726 """Test loading PDF from BytesIO with lazy=False."""
727 filename = "tests/data/regression/rotated_text_01.pdf"
728
729 # Read file into BytesIO
730 with open(filename, "rb") as file:
731 file_content = file.read()
732 bytes_io = BytesIO(file_content)
733
734 parser = DoclingPdfParser(loglevel="fatal")
735
736 # Load from BytesIO (eager)
737 pdf_doc_bytesio = parser.load(path_or_stream=bytes_io, lazy=False)
738
739 # Load from path (eager)
740 pdf_doc_path = parser.load(path_or_stream=filename, lazy=False)
741
742 # Pages should already be loaded
743 assert len(pdf_doc_bytesio._pages) > 0
744 assert len(pdf_doc_path._pages) > 0
745
746 # Pages should be identical
747 assert pdf_doc_bytesio._pages == pdf_doc_path._pages
748
749
750def test_list_loaded_keys_lifecycle():

Callers

nothing calls this directly

Calls 2

loadMethod · 0.95
DoclingPdfParserClass · 0.90

Tested by

no test coverage detected