test: MIXED 混合样本 + 端到端段落验证
This commit is contained in:
@@ -36,4 +36,25 @@ def test_free_text_sample_detected():
|
||||
if not p.exists():
|
||||
pytest.skip("样本缺失")
|
||||
result = ExcelParser().parse(p)
|
||||
assert any(t.extraction_method == "llm_from_free_text" for t in result.tables)
|
||||
assert any(t.extraction_method == "llm_from_free_text" for t in result.tables)
|
||||
|
||||
|
||||
def test_mixed_sample_segments_detected():
|
||||
p = _x("要件定義_混合型.xlsx")
|
||||
if not p.exists():
|
||||
pytest.skip("样本缺失")
|
||||
result = ExcelParser().parse(p)
|
||||
by_name = {t.name: t for t in result.tables}
|
||||
assert "機能一覧" in by_name
|
||||
assert result.mixed, "混合样本应产出段落"
|
||||
mixed = result.mixed[0]
|
||||
assert len(mixed.paragraphs) == 2 # 表格段 + 碎片段(・/■ 连续)
|
||||
assert [p.kind for p in mixed.paragraphs] == ["table", "free_text"]
|
||||
# 表格段无碎片污染
|
||||
table = [p.table for p in mixed.paragraphs if p.kind == "table"][0]
|
||||
assert table.rows[0]["機能ID"].value == "F101"
|
||||
assert len(table.rows) == 3
|
||||
# 碎片段含 ・ 与 ■ 两行文本
|
||||
ft = [p for p in mixed.paragraphs if p.kind == "free_text"][0]
|
||||
assert "改修ポイント" in (ft.text or "")
|
||||
assert "対象期間" in (ft.text or "")
|
||||
Reference in New Issue
Block a user