Files
Jyotisha/tests/test_report_restored_modules_1659.py
ClaudeandClaude Opus 5.5 81f1ab45d6 fix(report): yoga participants, nine-body transits, four restored sections; opening and appendix parity (BUG-1657..1659)
Compared against the upstream customer export of 2026-11-05.

- BUG-1657: detected yogas carry the planets the rule bound (structured
  evaluators, solar/lunar rows, loop-free custom expressions via AST; an
  `or` over different planets names nobody). The report lists participants
  and current-Dasha overlap instead of 未判定.
- BUG-1658: the dated transit table reads transit_positions, so all nine
  bodies have sign, degree, speed and retrograde.
- BUG-1659: Navamsha AD durations, current convergence (12 houses), Pancha
  Pakshi and Rashi Tulya Navamsa are put on the worksheet and rendered;
  Pancha Pakshi uses the birth weekday instead of always Sunday.
- Opening: timeline (next PDs, Narayana current period) and career /
  finance / relationship evidence (house lords, AmK/DK, A10/UL, D10/D9/D2/D11)
  under 「重点」, then a reading guide. The focus card stays under the title
  (BUG-1316).
- Traditional supportive practices are wired to the remedies module (reference
  only, mistranslations fixed, duplicate table removed).
- Appendix: Argala per-source detail, nakshatra reference with lord, gana,
  degree and KP sub-lord, and verified calculation notes.

tests/test_full_data_parity_chapters.py: the four "public gap" sections now
must carry real cells (原值/新值/原因 in the test).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbBXoyeZrYn6ryNcSe5Y2Y
2026-11-06 17:23:21 +08:00

72 lines
2.9 KiB
Python

"""BUG-1659: four sections printed 「公开报告资料包未带此模块」 although the full
reading computes them (Navamsha AD durations, current multi-system convergence,
Pancha Pakshi, Rashi Tulya Navamsa). Pancha Pakshi also always used Sunday.
"""
from __future__ import annotations
from types import SimpleNamespace
import pytest
from scripts.jyotish_engine import build_pl9_style_export_packet, cmd_full_reading
from scripts.report_render.parity_chapters import _convergence, _navamsha, _pancha_pakshi, _rashi_tulya
# Fictional chart. 1990-01-01 was a Monday.
CHART = {
"year": 1990, "month": 1, "day": 1, "hour": 12, "minute": 0, "second": 0,
"lat": 28.6139, "lon": 77.2090, "tz": 5.5, "ayanamsa": "raman", "node_mode": "mean",
"today": "2026-11-06", "transit_date": "2026-11-06", "target_year": 2026, "age": 36,
"birth_time_accuracy": "confirmed",
}
MISSING = "公开报告资料包未带此模块"
@pytest.fixture(scope="module")
def packet() -> dict:
return build_pl9_style_export_packet(cmd_full_reading(SimpleNamespace(**CHART)), include_raw=False)
def test_pancha_pakshi_uses_the_birth_weekday(packet: dict) -> None:
module = packet["worksheets"]["advanced_systems"]["pancha_pakshi"]
assert module["weekday"] == 1
assert module["weekday_source"] == "calendar_date"
text = _pancha_pakshi(packet, "zh")
assert MISSING not in text
assert "1990-01-01(周一)" in text
assert text.count("\n| ") >= 5
def test_convergence_lists_all_twelve_houses(packet: dict) -> None:
text = _convergence(packet, "zh")
assert MISSING not in text
rows = [line for line in text.splitlines() if line.startswith("| ") and not line.startswith("| 领域")]
assert len(rows) == 12
assert [row.split("|")[2].strip() for row in rows] == [str(house) for house in range(1, 13)]
assert all(row.split("|")[4].strip().startswith("L") for row in rows)
def test_navamsha_ad_durations_follow_the_dated_rows(packet: dict) -> None:
text = _navamsha(packet, "zh")
assert MISSING not in text
rows = [line for line in text.splitlines() if line.startswith("| 1 |")]
assert rows, text[:400]
module = packet["worksheets"]["timing_and_predictive_systems"]["navamsha_dasha"]
first_ad = module["periods"][0]["antardasha"][0]
assert f"| {first_ad['start']} | {first_ad['end']} |" in rows[0]
def test_rashi_tulya_maps_each_planet(packet: dict) -> None:
text = _rashi_tulya(packet, "zh")
assert MISSING not in text
analysis = packet["worksheets"]["advanced_systems"]["rashi_tulya_navamsa"]["analysis"]
rows = [line for line in text.splitlines() if line.startswith("| ") and not line.startswith("| 行星")]
assert len(rows) == len(analysis["planets"]) >= 7
english = _rashi_tulya(packet, "en")
assert "Mapped D1 house" in english
def test_absent_modules_still_say_so() -> None:
assert MISSING in _convergence({}, "zh")
assert MISSING in _pancha_pakshi({}, "zh")