47 lines
1.6 KiB
Python

#!/usr/bin/env python3
"""细纲功能合同的离线回归测试,不启动模型、不访问作品数据。"""
from pathlib import Path
import unittest
ROOT = Path(__file__).resolve().parents[4]
SKILL = (ROOT / ".claude/skills/fine-outline/SKILL.md").read_text(encoding="utf-8")
PLANNER = (ROOT / ".claude/agents/planner.md").read_text(encoding="utf-8")
CHAINS = (ROOT / "meta/chains/README.md").read_text(encoding="utf-8")
class FineOutlineContractTest(unittest.TestCase):
def test_contract_is_bound_to_existing_planner_slot(self):
self.assertIn("scenario: fine_outline", SKILL)
self.assertIn("fine_outline", PLANNER)
self.assertIn("fine_outline", CHAINS)
self.assertIn("规划→planner", CHAINS)
def test_candidate_fields_and_shadow_boundary_are_explicit(self):
for field in (
"targetChapter",
"chapterGoal",
"keyEvents",
"entities",
"foreshadowing",
"stateChanges",
"hook",
"unknowns",
"assumptions",
):
self.assertIn(field, SKILL)
self.assertIn("不得输出正文", SKILL)
self.assertIn("Shadow", SKILL)
self.assertIn("目标章细纲作为生成输入", SKILL)
def test_freeze_and_two_line_retrieval_rules_are_explicit(self):
self.assertIn("<= as_of", SKILL)
self.assertIn("卡是检索索引和事实补充", SKILL)
self.assertIn("目标章正文", SKILL)
self.assertIn("unknowns", SKILL)
if __name__ == "__main__":
unittest.main()