Files
Jyotisha/tests/test_reader_leftovers_2038.py
T
ClaudeandClaude Fable 5.2 af2e4988e8 fix: report and synastry reader text loses its last backstage wording (BUG-2038)
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
2026-11-19 19:49:28 +08:00

49 lines
2.5 KiB
Python

"""BUG-2038 (staging 复测第九轮, 2026-11-20): reader-text leftovers on the Python side of the personal report."""
from __future__ import annotations
from scripts.report_render import reading_facts
from scripts.report_render.opening_guide import timeline
def _packet(saturn_sign: str) -> dict:
timing = {
"transit_positions": {"target_date": "2026-11-19", "planets": {
"Saturn": {"sign": saturn_sign, "degree_in_sign": 15.6}, "Jupiter": {"sign": "Leo", "degree_in_sign": 3.3}}},
"transit_multi_reference": {"transit_analysis": {"Saturn": {"house_from_ref": {"Chandra_Lagna": {"house": 7}}}}},
}
return {
"core_chart": {"planets": {"Saturn": {"sign": "Pisces"}, "Jupiter": {"sign": "Capricorn"}}},
"worksheets": {
"timing_and_predictive_systems": timing,
"advanced_systems": {"yogas_doshas": {"sade_sati": {"is_active": False, "phase": "none", "moon_sign": "Virgo"}}},
},
}
def test_only_a_planet_back_in_its_natal_sign_is_given_to_the_reading() -> None:
# 复测第九轮正文:「行运木星从出生时的摩羯座走到狮子座,不在同一个星座。」
rows = reading_facts._transits(_packet("Pisces"), {})["transit_natal_sign"]
assert [row["planet"] for row in rows] == ["Saturn"] and rows[0]["same_sign"] is True
away = reading_facts._transits(_packet("Aries"), {})
assert "transit_natal_sign" not in away
# Saturn's house from the Moon is still stated when it is not in its natal sign.
assert away["sade_sati"]["saturn_from_moon"]["house"] == 7
def _narayana_packet() -> dict:
return {"worksheets": {"timing_and_predictive_systems": {"narayana_dasha": {
"algorithm_label": "Sanjay Rath 版(默认;按原书 p.43 正文(第七轮裁定))",
"algorithm_label_en": "Sanjay Rath version (default)",
"current_dasha": {"md": {"sign": "Libra", "start": "2018-08-08", "end": "2028-08-07", "start_age": 21.0, "end_age": 31.0}},
}}}}
def test_the_chinese_opening_names_the_narayana_period_without_the_profile_label() -> None:
# 复测第九轮开篇:「Narayana 当前大运(Sanjay Rath 版(默认;按原书 p.43 正文(第七轮裁定))):天秤座 …」
zh = timeline(_narayana_packet(), "zh")
assert "Narayana 当前大运:天秤座" in zh
assert "Sanjay Rath" not in zh and "第七轮裁定" not in zh
# The English opening is unchanged.
assert "Current Narayana period (Sanjay Rath version (default)): " in timeline(_narayana_packet(), "en")