- Sync references/mahadasha_editorial_bilingual.json (9 lords x 3 paragraphs, zh + en, per-paragraph source locators) and mahadasha_editorial_policy.md, plus the one-line pointers in SKILL.md and vimshottari_dasha_guide.md. - New chapter after 大运解释 in both editions: the three paragraphs side by side (general / traditionally supportive / traditionally strained), never picked by lord or chart, Mahadasha layer only; source labelled as secondary study notes with the original edition pending verification; English only in the English edition. - Coverage contract: the topic moves from NOT_CARRIED to the checked list. No change to the frozen exporter, dates or any scoring. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DbBXoyeZrYn6ryNcSe5Y2Y
63 lines
3.0 KiB
Python
63 lines
3.0 KiB
Python
"""「大运传统参考」 from the astrologer's bilingual text (yinduzhanxing 058c4f5f).
|
||
|
||
Policy (references/mahadasha_editorial_policy.md): three paragraphs side by
|
||
side, never picked by lord name; no diagnosis, lifespan or certainty words;
|
||
English edition fully English; Mahadasha layer only; the secondary source is
|
||
labelled as such.
|
||
"""
|
||
|
||
from __future__ import annotations
|
||
|
||
import json
|
||
import re
|
||
from pathlib import Path
|
||
|
||
from scripts.report_render.dasha_reference import insert_dasha_reference, load_reference, render_dasha_reference
|
||
|
||
ROOT = Path(__file__).resolve().parents[1]
|
||
FORBIDDEN_ZH = ("疾病", "必然", "一定会", "死亡", "你正在受克", "受克")
|
||
FORBIDDEN_EN = ("disease", "inevitable", "guarantee", "death")
|
||
|
||
|
||
def test_the_synced_text_has_nine_lords_three_paragraphs_each() -> None:
|
||
data = json.loads((ROOT / "references/mahadasha_editorial_bilingual.json").read_text(encoding="utf-8"))
|
||
assert data["personalized"] is False and data["upstream_reproduction"] is False
|
||
assert [planet["id"] for planet in data["planets"]] == ["Sun", "Moon", "Mars", "Mercury", "Jupiter", "Venus", "Saturn", "Rahu", "Ketu"]
|
||
for planet in data["planets"]:
|
||
kinds = [item["kind"] for item in planet["paragraphs"]]
|
||
assert kinds == ["general", "supportive_conditions", "strained_conditions"], planet["id"]
|
||
for item in planet["paragraphs"]:
|
||
assert item["zh"].strip() and item["en"].strip()
|
||
assert isinstance(item["pdf_page"], int)
|
||
|
||
|
||
def test_chinese_chapter_lists_all_three_paragraphs_and_labels_the_source() -> None:
|
||
text = render_dasha_reference("zh")
|
||
assert text.startswith("## 大运传统参考(通用)")
|
||
assert text.count("\n### ") == 9
|
||
for label in ("**一般背景**:", "**传统有利条件下**:", "**传统压力条件下**:"):
|
||
assert text.count(label) == 9
|
||
assert text.count("(二手资料;原典印刷版待核)") == 9
|
||
assert "不替这张盘做判断" in text and "不拼接小运" in text
|
||
for word in FORBIDDEN_ZH:
|
||
assert word not in text, word
|
||
|
||
|
||
def test_english_chapter_is_english_only() -> None:
|
||
text = render_dasha_reference("en")
|
||
assert text.startswith("## Traditional Dasha Reference (general)")
|
||
assert text.count("\n### ") == 9
|
||
assert not re.search(r"[一-鿿]", text)
|
||
assert text.count("(secondary source; original edition pending verification)") == 9
|
||
lowered = text.lower()
|
||
for word in FORBIDDEN_EN:
|
||
assert word not in lowered, word
|
||
|
||
|
||
def test_the_chapter_follows_the_dasha_interpretation_chapter() -> None:
|
||
markdown = "# 报告\n\n## 大运解释\n\n正文\n\n## 星座大运(本站计算)\n\n表\n"
|
||
out = insert_dasha_reference(markdown, "zh")
|
||
assert out.index("## 大运解释") < out.index("## 大运传统参考(通用)") < out.index("## 星座大运(本站计算)")
|
||
assert insert_dasha_reference("# 报告\n\n## 其他\n", "zh") == "# 报告\n\n## 其他\n"
|
||
assert load_reference()["status"] == "secondary_source_editorial_reference"
|