A pronoun whose planet was in a removed sentence takes that planet; only a planet back in its natal sign is given to the reading; the 现在这几年 section leads with the stage of life and dates only the main dasha; the health reminder is one fixed program sentence; the synastry appendix no longer doubles 所以 and shows the technical summary with names, no machine tags, minutes as 分 and 秒. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DbBXoyn7Hj3LCW3BUs5bZ8
114 lines
5.8 KiB
Python
114 lines
5.8 KiB
Python
"""Opening supplement: reading guide, timeline and domain evidence (upstream parity).
|
||
|
||
The upstream export opens with an AI reading guide, the current Narayana
|
||
period, the next sub-periods, and D10 / D9 / D2 / D11 placements behind career,
|
||
finances and relationships. These come from the packet; nothing is recomputed.
|
||
"""
|
||
|
||
from __future__ import annotations
|
||
|
||
from scripts.report_render.opening_guide import insert_opening_supplement, render_opening_supplement
|
||
|
||
|
||
def _packet() -> dict:
|
||
return {
|
||
"report_language": "zh",
|
||
"worksheets": {
|
||
"d1_rasi_bhava": {
|
||
"houses": {
|
||
"1": {"cusp_sign": "Aries", "lord": "Mars"},
|
||
"2": {"cusp_sign": "Taurus", "lord": "Venus"},
|
||
"7": {"cusp_sign": "Libra", "lord": "Venus"},
|
||
"10": {"cusp_sign": "Capricorn", "lord": "Saturn"},
|
||
"11": {"cusp_sign": "Aquarius", "lord": "Saturn"},
|
||
},
|
||
"planets": {
|
||
"Saturn": {"sign": "Capricorn", "house": 10},
|
||
"Venus": {"sign": "Pisces", "house": 12},
|
||
"Mars": {"sign": "Aries", "house": 1},
|
||
},
|
||
},
|
||
"divisional_and_special_charts": {
|
||
"varga_full": {
|
||
"D10_Dasamsa": {"Ascendant": {"sign": "Leo"}, "Saturn": {"sign": "Libra"}, "Mars": {"sign": "Leo"}},
|
||
"D9_Navamsa": {"Ascendant": {"sign": "Cancer"}, "Saturn": {"sign": "Capricorn"}, "Venus": {"sign": "Pisces"}},
|
||
"D2_Hora": {"Ascendant": {"sign": "Leo"}, "Venus": {"sign": "Cancer"}},
|
||
"D11_Rudramsa": {"Ascendant": {"sign": "Gemini"}, "Saturn": {"sign": "Virgo"}},
|
||
},
|
||
},
|
||
"advanced_systems": {
|
||
"jaimini": {
|
||
"chara_karaka_7": {"karaka_table": {
|
||
"Amatyakaraka": {"planet": "Mars"},
|
||
"Darakaraka": {"planet": "Venus"},
|
||
}},
|
||
"arudha_padas": {"padas": {"A10": {"sign": "Taurus"}, "UL": {"sign": "Libra"}}},
|
||
},
|
||
},
|
||
"timing_and_predictive_systems": {
|
||
"dasha": {"current_dasha": {
|
||
"lord": "Saturn", "start": "2018-05-26", "end": "2037-05-25",
|
||
"antardasha_timeline": [{
|
||
"lord": "Venus", "is_current": True, "start": "2025-03-16", "end": "2028-05-16",
|
||
"pratyantar_dasha_timeline": [
|
||
{"lord": "Jupiter", "is_current": True, "start": "2026-10-25", "end": "2027-03-28"},
|
||
{"lord": "Saturn", "start": "2027-03-28", "end": "2027-09-28"},
|
||
{"lord": "Mercury", "start": "2027-09-28", "end": "2028-03-09"},
|
||
],
|
||
}],
|
||
}},
|
||
"narayana_dasha": {
|
||
"algorithm_label": "任务包算法",
|
||
"algorithm_label_en": "Packet method",
|
||
"seed_sign": "Aquarius",
|
||
"current_dasha": {"md": {
|
||
"sign": "Cancer", "start_age": 30.0, "end_age": 39.0,
|
||
"start_date": "2022-08-01", "end_date": "2031-08-01",
|
||
}},
|
||
},
|
||
},
|
||
},
|
||
}
|
||
|
||
|
||
def test_supplement_has_guide_timeline_and_domain_tables() -> None:
|
||
text = render_opening_supplement(_packet(), "zh")
|
||
assert text.startswith("## 阅读说明")
|
||
assert "MD" not in text.split("### 时间线")[0]
|
||
assert "- 土星:2027-03-28 → 2027-09-28" in text
|
||
assert "- 水星:2027-09-28 → 2028-03-09" in text
|
||
# 原值: "Narayana 当前大运(任务包算法):巨蟹座 2022-08-01 → 2031-08-01"
|
||
# 新值: 中文开篇不带算法标签
|
||
# 原因: BUG-2038,复测第九轮开篇出现「Sanjay Rath 版(默认;按原书 p.43 正文(第七轮裁定))」;
|
||
# 版本出处是后台信息,留在 Narayana 章节。英文版仍带标签。
|
||
assert "Narayana 当前大运:巨蟹座 2022-08-01 → 2031-08-01" in text
|
||
assert "任务包算法" not in text.split("### 时间线")[1].split("###")[0]
|
||
assert "起运星座 水瓶座" in text
|
||
# Career: 10th lord Saturn + AmK Mars in D10 and D9; A10 Taurus is natal house 2.
|
||
assert "| D10 | 狮子座 | 土星 | 天秤座 | 3 |" in text
|
||
assert "| D10 | 狮子座 | 火星 | 狮子座 | 1 |" in text
|
||
assert "A10(事业宫 Arudha):金牛座,本命第 2 宫" in text
|
||
# Saturn is the current MD lord, so its houses are foregrounded.
|
||
assert "现在是当前大运三级主星之一" in text
|
||
# Relationships: 7th lord Venus is also DK; listed once in D9; UL Libra is natal 7.
|
||
assert text.count("| D9 | 巨蟹座 | 金星 | 双鱼座 | 9 |") == 1
|
||
assert "UL(Upapada,第 12 宫 Arudha):天秤座,本命第 7 宫" in text
|
||
|
||
|
||
def test_focus_card_stays_under_the_title_and_the_guide_follows() -> None:
|
||
markdown = "# 印度占星星盘报告\n\n## 重点\n\n```jyotish-focus\n{}\n```\n\n## 出生资料与图盘\n\n正文"
|
||
out = insert_opening_supplement(markdown, _packet(), "zh")
|
||
# BUG-1316: the focus card stays directly under the title.
|
||
order = [out.index(marker) for marker in ("# 印度占星星盘报告", "## 重点", "```jyotish-focus", "### 时间线", "### 三个领域的盘面依据", "## 阅读说明", "## 出生资料与图盘")]
|
||
assert order == sorted(order)
|
||
|
||
|
||
def test_english_supplement() -> None:
|
||
packet = _packet()
|
||
packet["report_language"] = "en"
|
||
text = render_opening_supplement(packet, "en")
|
||
assert text.startswith("## AI Reading Guide")
|
||
assert "Current Narayana period (Packet method): Cancer 2022-08-01 → 2031-08-01" in text
|
||
assert "| D10 | Leo | Saturn | Libra | 3 |" in text
|
||
assert not any("一" <= ch <= "鿿" for ch in text)
|