Venus/Jupiter/Moon periods no longer collapse into one marriage-opportunity line. Full reading reports the ten BPHS conditional dasha families; Skill 6.9.16. Co-authored-by: Cursor <cursoragent@cursor.com>
122 lines
3.9 KiB
Python
122 lines
3.9 KiB
Python
"""Conditional dasha families in full reading and the time-system table."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
from scripts.jyotish_engine import cmd_full_reading, render_pl9_markdown, _native_dasha_master_families
|
|
from scripts.professional_report_reference import _export_args
|
|
from tests.test_report_longform_parity import _producer_packet
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
BASELINE = (ROOT / "tests/golden/upstream_sync2/pl9_time_system_table.baseline.md").read_text(encoding="utf-8")
|
|
|
|
EINSTEIN = {
|
|
"year": 1879,
|
|
"month": 3,
|
|
"day": 14,
|
|
"hour": 11,
|
|
"minute": 30,
|
|
"second": 0,
|
|
"lat": 48.4,
|
|
"lon": 9.98,
|
|
"tz": 0.89,
|
|
"ayanamsa": "raman",
|
|
"node_mode": "mean",
|
|
}
|
|
|
|
CONDITIONAL_KEYS = (
|
|
"tribhagi_dasha",
|
|
"tribhagi_40_dasha",
|
|
"shodashottari_dasha",
|
|
"dwadashottari_dasha",
|
|
"dwisaptatisama_dasha",
|
|
"shattrimshatsama_dasha",
|
|
"panchottari_dasha",
|
|
"satabdika_dasha",
|
|
"chaturshitisama_dasha",
|
|
"shastihayani_dasha",
|
|
)
|
|
|
|
NEW_TABLE_LABELS = (
|
|
"Tribhagi",
|
|
"Tribhagi 40",
|
|
"Shodashottari",
|
|
"Dwadashottari",
|
|
"Dwisaptatisama",
|
|
"Shastihayani",
|
|
"Shattrimshatsama",
|
|
"Panchottari",
|
|
"Satabdika",
|
|
"Chaturshitisama",
|
|
)
|
|
|
|
|
|
def _table_data_rows(markdown: str) -> list[str]:
|
|
lines = markdown.splitlines()
|
|
start = next(i for i, line in enumerate(lines) if line.strip() == "#### 时间系统证据状态")
|
|
rows = []
|
|
for line in lines[start + 3 :]:
|
|
if not line.startswith("|"):
|
|
break
|
|
if line.startswith("|------"):
|
|
continue
|
|
if line.startswith("| 系统 |"):
|
|
continue
|
|
rows.append(line)
|
|
return rows
|
|
|
|
|
|
def test_einstein_full_reading_exposes_ten_conditional_dasha_modules() -> None:
|
|
report = cmd_full_reading(_export_args(EINSTEIN))
|
|
modules = report.get("modules") if isinstance(report.get("modules"), dict) else {}
|
|
for key in CONDITIONAL_KEYS:
|
|
payload = modules.get(key)
|
|
assert isinstance(payload, dict), key
|
|
has_periods = isinstance(payload.get("periods"), list) or isinstance(payload.get("major"), list)
|
|
status = str(payload.get("execution_status") or payload.get("status") or "")
|
|
assert has_periods or status in {"not_applicable", "blocked"} or payload.get("error"), key
|
|
|
|
markdown = render_pl9_markdown(_producer_packet({
|
|
"timing_and_predictive_systems": {
|
|
"dasha": modules.get("dasha"),
|
|
"narayana_dasha": modules.get("narayana_dasha"),
|
|
"yogini_dasha": modules.get("yogini_dasha"),
|
|
"ashtottari_dasha": modules.get("ashtottari_dasha"),
|
|
"kalachakra_dasha": modules.get("kalachakra_dasha"),
|
|
**{key: modules.get(key) for key in CONDITIONAL_KEYS},
|
|
"dasha_master_pack": {
|
|
"schema": "dasha_master_report_pack_v1",
|
|
"families": _native_dasha_master_families(modules),
|
|
},
|
|
"annual_tajika_pack": {"year_lord": {"status": "partial_verified"}},
|
|
},
|
|
}))
|
|
rows = _table_data_rows(markdown)
|
|
original = [
|
|
line for line in BASELINE.splitlines()
|
|
if line.startswith("| ")
|
|
and not line.startswith("| 系统 |")
|
|
and "| Year Lord |" not in line
|
|
]
|
|
assert rows[:5] == original
|
|
for label in NEW_TABLE_LABELS:
|
|
assert any(f"| {label} |" in line for line in rows)
|
|
assert any("| Year Lord |" in line for line in rows)
|
|
assert len(rows) >= 15
|
|
|
|
|
|
def test_calc_dasa_convergence_call_is_unchanged() -> None:
|
|
text = (ROOT / "scripts/jyotish_engine.py").read_text(encoding="utf-8")
|
|
needle = """ convergence = _calc_dasa_convergence(
|
|
dasha_data,
|
|
chara_dasha_data,
|
|
yogini_data,
|
|
planet_lons,
|
|
asc_idx,
|
|
ashtottari_result=ashtottari_data,
|
|
kalachakra_result=kalachakra_data,
|
|
)"""
|
|
assert needle in text
|