Test loading PDF from BytesIO with lazy=False.
()
| 723 | |
| 724 | |
| 725 | def 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 | |
| 750 | def test_list_loaded_keys_lifecycle(): |
nothing calls this directly
no test coverage detected