Files
Jyotisha/tests/test_shadbala_sun_minimum_bphs.py
T

26 lines
1.1 KiB
Python

"""BUG-1189 (清单 F3): Shadbala minimum requirements follow BPHS ch. 27 sl. 32-33.
"390, 360, 300, 420, 390, 330 and 300 Virupas are the Shad Bal Pindas, needed
for Surya etc. to be considered strong" -> 60 virupas per rupa.
"""
from __future__ import annotations
from scripts.shadbala import MIN_REQUIRED, VIRUPAS_PER_RUPA, calc_shadbala
from tests.test_shadbala_precise_context import _planets
BPHS_VIRUPAS = {"Sun": 390, "Moon": 360, "Mars": 300, "Mercury": 420, "Jupiter": 390, "Venus": 330, "Saturn": 300}
def test_minimum_table_matches_bphs() -> None:
# 原值: Sun 5.0;新值: 6.5;其余六星不变
assert {planet: value / VIRUPAS_PER_RUPA for planet, value in BPHS_VIRUPAS.items()} == MIN_REQUIRED
def test_sun_ishta_percentage_uses_six_and_a_half_rupas() -> None:
planets = _planets()
result = calc_shadbala(planets, "Aries", 12.0, planets["Sun"]["degree"], planets["Moon"]["degree"])
sun = result["planets"]["Sun"]
assert sun["min_required"] == 6.5
assert abs(sun["ishta_bala_pct"] - round(sun["total_rupas"] / 6.5 * 100, 1)) <= 0.1