Files
Jyotisha/tests/test_narayana_method_comparison.py
T

62 lines
2.3 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""Narayana display keeps the historical sequence and names the selected seed (BUG-1264)."""
from __future__ import annotations
from scripts.narayana_dasha import (
calc_narayana_mahadasha,
narayana_dasha_full_report,
narayana_report_with_variants,
)
LONGS = {
"Sun": 10.0,
"Moon": 40.0,
"Mars": 70.0,
"Mercury": 100.0,
"Jupiter": 130.0,
"Venus": 160.0,
"Saturn": 15.0,
"Rahu": 250.0,
"Ketu": 70.0,
}
def test_default_calc_matches_the_explicit_legacy_profiles() -> None:
plain = calc_narayana_mahadasha(0, LONGS)
explicit = calc_narayana_mahadasha(
0,
LONGS,
0.0,
duration_profile="legacy_forward_v0",
sequence_profile="legacy_zodiacal_v0",
seed_profile="legacy_lagna_v0",
dual_lord_profile="legacy_primary_lord_v0",
)
assert plain == explicit
report = narayana_dasha_full_report(0, LONGS, current_age=30, birth_year=1990)
assert [row["sign"] for row in report["mahadasha_sequence"]] == [row["sign"] for row in plain]
assert report["interpretation"][1].startswith("起运星座: Aries(所选起运规则 legacy_lagna_v0)")
assert "(Lagna)" not in report["interpretation"][1]
def test_source_aware_comparison_does_not_replace_the_historical_sequence() -> None:
compared = narayana_report_with_variants(0, LONGS, current_age=30, birth_year=1990)
historical = narayana_dasha_full_report(0, LONGS, current_age=30, birth_year=1990)
assert [row["years"] for row in compared["mahadasha_sequence"]] == [row["years"] for row in historical["mahadasha_sequence"]]
source = compared["method_comparison"]["source_aware"]
assert source["seed_selection"]["profile"] == "jaimini_lagna_seventh_strength_v1"
assert "jaimini_lagna_seventh_strength_v1" in source["interpretation"][1]
assert compared["comparison_required"] is True
def test_ketu_in_the_seed_is_blocked_without_table_12() -> None:
longs = dict(LONGS)
longs["Saturn"] = 200.0
longs["Ketu"] = 5.0
compared = narayana_report_with_variants(0, longs, current_age=10, birth_year=1990)
source = compared["method_comparison"]["source_aware"]
assert source["status"] == "blocked"
assert "rath_ketu_table12_v1" in source["reason"]
assert compared["mahadasha_sequence"][0]["sign"] == "Aries"