- tests/docgen/:DC-UNIT/API/CONF/E2E/UI/REGRESSION/PERF 分组用例与可复跑脚本,报告逐条留痕(R1-R3 全记录) - 意图 30 条前后端同表双跑(pytest + node) - Playwright headless:docgen-ui/docgen-regression spec + b3 benchpanel 第 5 TAB 断言更新 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
31 lines
1.2 KiB
Python
31 lines
1.2 KiB
Python
# -*- coding: utf-8 -*-
|
||
"""tests/docgen/test_intent_cases.py —— DC-INTENT-CASES-01~30(后端 pytest)。
|
||
|
||
唯一事实源:docs/team/cases_intent.md(30 条表,测试用副本 tests/docgen/cases_intent.md)。
|
||
数据文件:tests/docgen/data/intent_cases.json(由本文件从冻结表转写,转写后与 cases_intent.md 核对)。
|
||
执行:bash tests/docgen/run_all.sh intent(后端);前端同表双跑见 test_intent_frontend.mjs。
|
||
"""
|
||
from __future__ import annotations
|
||
|
||
import json
|
||
from pathlib import Path
|
||
|
||
import pytest
|
||
|
||
DATA = Path(__file__).resolve().parent / "data"
|
||
CASES = json.loads((DATA / "intent_cases.json").read_text(encoding="utf-8"))
|
||
|
||
try:
|
||
from app.services.docgen import intent as imod
|
||
except ImportError:
|
||
imod = None
|
||
|
||
|
||
@pytest.mark.skipif(imod is None, reason="PENDING: app.services.docgen.intent 未交付")
|
||
@pytest.mark.parametrize("case", CASES, ids=[f"#{c['num']}" for c in CASES])
|
||
def test_intent_case(case):
|
||
route = getattr(imod, "route", None) or getattr(imod, "route_intent", None)
|
||
assert route is not None
|
||
got = route(case["text"], case["has_attachments"], case["has_active_artifact"])
|
||
assert got == case["expected"], f"#{case['num']} {case['text']!r} -> {got},期望 {case['expected']}"
|