test: 真实样本集成测试(3 类型 xlsx)

This commit is contained in:
lhl
2026-08-09 03:18:12 +08:00
parent 18da20dc0a
commit 3307d7ba72
2 changed files with 41 additions and 1 deletions
+39
View File
@@ -0,0 +1,39 @@
from pathlib import Path
import pytest
from genesis.parsers.excel_parser import ExcelParser
SAMPLES = Path(__file__).resolve().parents[1] / "samples"
def _x(name: str) -> Path:
return SAMPLES / name
def test_new_dev_sample_has_tables():
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 by_name["機能一覧"].rows
assert any(t.name == "DB定義" for t in result.tables)
def test_additional_modification_has_tables():
p = _x("要件定義_追加改修.xlsx")
if not p.exists():
pytest.skip("样本缺失")
result = ExcelParser().parse(p)
assert result.tables
assert any(t.rows for t in result.tables)
def test_free_text_sample_detected():
p = _x("要件定義_自由記述.xlsx")
if not p.exists():
pytest.skip("样本缺失")
result = ExcelParser().parse(p)
assert any(t.extraction_method == "llm_from_free_text" for t in result.tables)