@@ -112,10 +112,10 @@ def test_table_to_html_with_spans():
112112@pytest .mark .asyncio
113113async def test_process_figure_without_bounding_regions ():
114114 figure = DocumentFigure (id = "1" , caption = None , bounding_regions = None )
115- result = await DocumentAnalysisParser .process_figure (None , figure )
115+ result = await DocumentAnalysisParser .figure_to_image (None , figure )
116116
117117 assert isinstance (result , ImageOnPage )
118- assert result .description == ""
118+ assert result .description is None
119119 assert result .title == ""
120120 assert result .figure_id == "1"
121121 assert result .page_num == 0
@@ -143,10 +143,10 @@ def mock_crop_image_from_pdf_page(doc, page_number, bounding_box):
143143 monkeypatch .setattr (DocumentAnalysisParser , "crop_image_from_pdf_page" , mock_crop_image_from_pdf_page )
144144
145145 with caplog .at_level (logging .WARNING ):
146- result = await DocumentAnalysisParser .process_figure (doc , figure )
146+ result = await DocumentAnalysisParser .figure_to_image (doc , figure )
147147
148148 assert isinstance (result , ImageOnPage )
149- assert result .description == ""
149+ assert result .description is None
150150 assert result .title == "Logo"
151151 assert result .bytes == b"image_bytes"
152152 assert result .page_num == 0
@@ -294,8 +294,7 @@ async def mock_poller_result():
294294 monkeypatch .setattr (mock_poller , "result" , mock_poller_result )
295295
296296 parser = DocumentAnalysisParser (
297- endpoint = "https://example.com" ,
298- credential = MockAzureCredential (),
297+ endpoint = "https://example.com" , credential = MockAzureCredential (), process_figures = True
299298 )
300299
301300 with open (TEST_DATA_DIR / "Simple Figure.pdf" , "rb" ) as f :
@@ -357,14 +356,13 @@ async def mock_poller_result():
357356 monkeypatch .setattr (mock_poller , "result" , mock_poller_result )
358357
359358 parser = DocumentAnalysisParser (
360- endpoint = "https://example.com" ,
361- credential = MockAzureCredential (),
359+ endpoint = "https://example.com" , credential = MockAzureCredential (), process_figures = True
362360 )
363361 content = io .BytesIO (b"pdf content bytes" )
364362 content .name = "test.docx"
365363 with caplog .at_level (logging .ERROR ):
366364 pages = [page async for page in parser .parse (content )]
367- assert "does not support high-resolution figure extraction " in caplog .text
365+ assert "does not support media description. " in caplog .text
368366
369367 assert len (pages ) == 1
370368 assert pages [0 ].page_num == 0
0 commit comments