作者场景路由与指令、完善故事基础设定/合并故事方案/制定作品规划的技能中文化重构及其脚本、对应旧测试修改、SOT 导读、技能目录与实现回顾。此为 W13 阶段对已跟踪文件的改动,随批次按阶段整理补提交。
46 lines
1.6 KiB
Python
46 lines
1.6 KiB
Python
#!/usr/bin/env python3
|
||
"""完善故事基础设定 选定交接闸离线测试。"""
|
||
import sys
|
||
from pathlib import Path
|
||
|
||
import click
|
||
|
||
PROJECT_ROOT = Path(__file__).resolve().parents[3]
|
||
SCRIPTS = PROJECT_ROOT / "muse" / "lifecycle" / "flow" / "skills" / "book" / "完善故事基础设定" / "scripts"
|
||
sys.path.insert(0, str(SCRIPTS))
|
||
|
||
from assert_selection_handoff import HandoffError, assert_selection_handoff # noqa: E402
|
||
|
||
|
||
def expect_fail(payload) -> None:
|
||
try:
|
||
assert_selection_handoff(payload)
|
||
except HandoffError:
|
||
return
|
||
raise AssertionError("应失败关闭")
|
||
|
||
|
||
def main() -> None:
|
||
ok = assert_selection_handoff({
|
||
"selectedCandidate": ".agents.local/草稿/作品/作品探索.md",
|
||
"confirmedByUser": True,
|
||
"confirmedAt": "2026-08-20T12:00:00+08:00",
|
||
})
|
||
assert ok["selectedCandidate"].endswith("作品探索.md")
|
||
expect_fail({})
|
||
expect_fail({"selectedCandidate": "x", "confirmedByUser": False, "confirmedAt": "t"})
|
||
for unconfirmed in ("false", "true", "user", 1, ["true"]):
|
||
expect_fail({"selectedCandidate": "x", "confirmedByUser": unconfirmed, "confirmedAt": "t"})
|
||
expect_fail({"selectedCandidate": "", "confirmedByUser": True, "confirmedAt": "t"})
|
||
expect_fail({"selectedCandidate": ["x"], "confirmedByUser": True, "confirmedAt": "t"})
|
||
expect_fail({"selectedCandidate": "x", "confirmedByUser": True, "confirmedAt": " "})
|
||
try:
|
||
raise HandoffError("x")
|
||
except click.ClickException:
|
||
pass
|
||
print("PASS:selection handoff 门全部通过")
|
||
|
||
|
||
if __name__ == "__main__":
|
||
main()
|