From 01c93e52d3bdbdcc403a36caa747c3e9781baeb3 Mon Sep 17 00:00:00 2001 From: Peter Zhang <18501667167@qq.com> Date: Mon, 1 Jun 2026 10:16:23 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=5Fhas=5Fsection=5Fcontent()=20?= =?UTF-8?q?=E8=BF=87=E6=BB=A4=E7=A9=BA=E7=AB=A0=E8=8A=82=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E7=AB=A0=E8=8A=82=E8=A6=86=E7=9B=96=E7=8E=87=E8=AF=AF?= =?UTF-8?q?=E6=8A=A5=20-=20Closes=20#29?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.7 --- tests/acceptance/test_main_health.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/tests/acceptance/test_main_health.py b/tests/acceptance/test_main_health.py index 0a55bca..6a027af 100644 --- a/tests/acceptance/test_main_health.py +++ b/tests/acceptance/test_main_health.py @@ -105,6 +105,24 @@ def _is_functional_section(section_name: str) -> bool: return True +def _has_section_content(sec: dict) -> bool: + """Check if a section has meaningful content (text, table, or image). + + A section is considered "empty" (no real content) if all its text blocks + have fewer than 10 characters and it contains no tables or images. + """ + for block in sec.get("blocks", []): + blk_type = block.get("type", "") + if blk_type == "table": + return True + if blk_type in ("image", "figure", "picture"): + return True + text = block.get("text", "") + if isinstance(text, str) and len(text.strip()) >= 10: + return True + return False + + def _extract_content_units(parsed_data: dict) -> dict: """Extract countable content units from parsed JSON. @@ -119,7 +137,7 @@ def _extract_content_units(parsed_data: dict) -> dict: for sec in sections: name = sec.get("source", "") - if _is_functional_section(name): + if _is_functional_section(name) and _has_section_content(sec): functional_sections.append({ "name": name, "number": _section_number(name), -- 2.52.0