Transforms complex documents like PDFs and Office docs into LLM-ready markdown/JSON for your Agentic workflows.
Python ai4sciencedocument-analysisdocxextract-datalayout-analysisocrparserpdfpdf-converterpdf-extractor-llmpdf-extractor-pretrainpdf-extractor-ragpdf-parserpptxpythonxlsx
feat: update Span to use 'content' instead of 'html' for table spans and add test for legacy HTML payload
myhloli7c4387c5f002
diff --git a/tests/unittest/test_doclib_progressive_reading.py b/tests/unittest/test_doclib_progressive_reading.pyindex b01b1ffa..de2dcbd0 100644--- a/tests/unittest/test_doclib_progressive_reading.py+++ b/tests/unittest/test_doclib_progressive_reading.py@@ -179,7 +179,7 @@ def test_page_markdown_blocks_prefers_markdown_table_in_doclib() -> None:lines=[Line(bbox=(0, 0, 10, 10),- spans=[Span(type=ContentType.TABLE, bbox=(0, 0, 10, 10), html=html)],+ spans=[Span(type=ContentType.TABLE, bbox=(0, 0, 10, 10), content=html)],)],)diff --git a/tests/unittest/test_parser_api_contract.py b/tests/unittest/test_parser_api_contract.pyindex 884b986a..b7d2db8b 100644--- a/tests/unittest/test_parser_api_contract.py+++ b/tests/unittest/test_parser_api_contract.py@@ -604,8 +604,9 @@ def test_api_server_rejects_bare_vlm_backend(tmp_path: Path) -> None:def test_api_server_accepts_parser_backend_values(tmp_path: Path) -> None:- from mineru.utils.backend_options import normalize_backend+ from mineru.utils.backend_options import HTTP_CLIENT_BACKEND_CHOICES, LOCAL_BACKEND_CHOICES, normalize_backend+ assert _API_SERVER_BACKENDS == LOCAL_BACKEND_CHOICES + HTTP_CLIENT_BACKEND_CHOICESassert "vlm" not in _API_SERVER_BACKENDSassert "hybrid" not in _API_SERVER_BACKENDSdiff --git a/tests/unittest/test_render_html_table.py b/tests/unittest/test_render_html_table.pyindex db16dbaf..1151bf6f 100644--- a/tests/unittest/test_render_html_table.py+++ b/tests/unittest/test_render_html_table.py@@ -4,6 +4,23 @@ from mineru.render.markdown_table import to_markdown_tablefrom mineru.types import Block, BlockType, ContentType, Line, PageInfo, Span+def test_table_span_ignores_legacy_html_payload_alias() -> None:+ """表格 span 只接受 content 承载 HTML,不再兼容旧 html 别名。"""+ span = Span.from_dict(+ {+ "type": ContentType.TABLE,+ "bbox": [0.0, 0.0, 10.0, 10.0],+ "html": "<table><tr><td>A</td></tr></table>",+ }+ )++ assert span.content == ""+ assert span.to_dict() == {+ "type": ContentType.TABLE,+ "bbox": (0.0, 0.0, 10.0, 10.0),+ }++def test_to_markdown_table_renders_simple_table() -> None:html = """<table>@@ -120,7 +137,7 @@ def test_blocks_to_markdown_prefers_markdown_table_when_enabled() -> None:lines=[Line(bbox=(0.0, 0.0, 10.0, 10.0),- spans=[Span(type=ContentType.TABLE, bbox=(0.0, 0.0, 10.0, 10.0), html=html)],+ spans=[Span(type=ContentType.TABLE, bbox=(0.0, 0.0, 10.0, 10.0), content=html)],)],)@@ -158,7 +175,7 @@ def test_render_markdown_prefers_markdown_table_when_enabled() -> None:lines=[Line(bbox=(0.0, 0.0, 10.0, 10.0),- spans=[Span(type=ContentType.TABLE, bbox=(0.0, 0.0, 10.0, 10.0), html=html)],+ spans=[Span(type=ContentType.TABLE, bbox=(0.0, 0.0, 10.0, 10.0), content=html)],)],)