第 1 卷(人物主线):第 1–3 集 + 人物表

主角线:Guspu Frillyknots / Ral Fastenhatchets / Alath Blottedmine
由线索挖掘器自动选定,按因果链切集,经 5 维度自评闸门(≥12 分)后入库。
This commit is contained in:
Chen Yi
2026-10-05 19:28:49 +08:00
parent 594cf48a1a
commit e0073e90bd
24 changed files with 2070 additions and 79 deletions
+44 -3
View File
@@ -12,7 +12,7 @@ from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
from dfannals import factcheck, legends # noqa: E402
from dfannals import factcheck, legends
FIXTURES = Path(__file__).resolve().parent / "fixtures"
@@ -30,8 +30,49 @@ def test_world_parsed() -> None:
assert world.figure_name(10) == "Urist McMiner"
assert world.site_name(1) == "Boatmurdered"
assert world.entity_name(100) == "The Steel Confederacy"
assert len(world.events) == 3
assert [e.year for e in world.events] == [30, 31, 88]
assert len(world.events) == 7
assert [e.year for e in world.events] == [30, 31, 40, 41, 42, 43, 88]
def test_field_classifier_covers_relationship_fields() -> None:
"""回归:旧版只认 4 个人物字段,导致双方关系在素材里被丢掉。"""
from dfannals.legends import kind_of
for tag in ("hfid", "hfid_target", "group_1_hfid", "group_2_hfid", "snatcher_hfid",
"seeker_hfid", "hfid1", "hfid2", "wounder_hfid", "teacher_hfid",
"conspirator_hfid", "slayer_hfid"):
assert kind_of(tag) == "figure", tag
for tag in ("target_enid", "entity_id", "attacker_civ_id"):
assert kind_of(tag) == "entity", tag
for tag in ("identity_id", "master_wcid", "slayer_item_id",
"slayer_race", "reason", "relationship"):
assert kind_of(tag) is None, tag
def test_relationship_events_render_both_sides() -> None:
"""核心契约:四类关系事件必须渲染出双方,而不是只剩单方面 hfid。"""
world = load_world()
rendered = {e.type: world.render_refs(e) for e in world.events}
link = rendered["add hf hf link"]
assert "hfid=Urist McMiner" in link and "hfid_target=Liri Fogbalded" in link
battle = rendered["hf simple battle event"]
assert "group_1_hfid=Urist McMiner" in battle and "group_2_hfid=Kogan Deathspear" in battle
abduct = rendered["hf abducted"]
assert "snatcher_hfid=Kogan Deathspear" in abduct and "target_hfid=Liri Fogbalded" in abduct
denied = rendered["hf relationship denied"]
assert "seeker_hfid=Liri Fogbalded" in denied and "target_hfid=Urist McMiner" in denied
def test_figure_ids_excludes_placeholder_and_dedups() -> None:
world = load_world()
battle = next(e for e in world.events if e.type == "hf simple battle event" and e.year == 41)
assert sorted(battle.figure_ids()) == [10, 11]
# hfid 与 slayer_hfid 同指一人时不应重复计数
assert len(battle.figure_ids()) == len(set(battle.figure_ids()))
def test_fake_names_are_caught() -> None: