- run_match 新增 skip_incomplete:批量缺省跳过画像不完整教师并记录 skipped,指定单教师仍 PROFILE_INCOMPLETE;汇总页出"画像待补录"行 - render-html 补 --report-id 行上下文(inputMapping $row.$pk),CLI 容错解析回退最近 10 份 - report_service 日志改容错 _log(),修复未 setup 时单跑测试崩溃的顺序依赖 - fixtures 替换为教师画像/赛道/期望结论金标准样例,新增 sample_tracks.json - 新增 4 个批量跳过用例(314 项,除 3 个已知 jsonschema 环境失败外全绿) - tests/README 增补本机无共享 runtime 的测试方式;TUTORIAL/ACTIONS.md 同步表述
41 lines
1.4 KiB
Plaintext
41 lines
1.4 KiB
Plaintext
# -*- coding: utf-8 -*-
|
||
# 样例:复制为 ``tests/test_golden_cases.py`` 后运行;默认不收集。
|
||
"""
|
||
Golden fixture 回归(示意)。
|
||
|
||
- 从 ``tests/fixtures/`` 读取脱敏 JSON。
|
||
- 调用 service 层(复制后替换为真实 import)。
|
||
- 断言关键字段,而非全文 diff(外部系统常带时间戳/非确定性字段)。
|
||
"""
|
||
from __future__ import annotations
|
||
|
||
import json
|
||
import os
|
||
import unittest
|
||
|
||
|
||
def _fixtures_dir() -> str:
|
||
return os.path.join(os.path.dirname(__file__), "..", "fixtures")
|
||
|
||
|
||
class TestGoldenCasesSample(unittest.TestCase):
|
||
def test_sample_request_matches_expected_shape(self) -> None:
|
||
req_path = os.path.join(_fixtures_dir(), "sample_request.json")
|
||
exp_path = os.path.join(_fixtures_dir(), "expected_response.json")
|
||
with open(req_path, encoding="utf-8") as f:
|
||
req = json.load(f)
|
||
with open(exp_path, encoding="utf-8") as f:
|
||
exp = json.load(f)
|
||
# 本技能:sample_request = 教师画像数组(import-teachers 可直接消费)
|
||
self.assertIsInstance(req, list)
|
||
self.assertEqual(req[0]["teacherName"], "张教授")
|
||
# 示意:run_match(req, tracks, exp["season"]) 后断言关键字段
|
||
self.assertEqual(exp["season"], "2027")
|
||
top = exp["expectations"][0]
|
||
self.assertEqual(top["tier"], "强烈推荐")
|
||
self.assertEqual(top["matchPct"], 100)
|
||
|
||
|
||
if __name__ == "__main__":
|
||
unittest.main()
|