Files
Jyotisha/tests/test_shadbala_sun_minimum_bphs.py
T
Jesse_ChenandClaude Opus 5.5 09c0efc2a1 fix(shadbala): Sun minimum requirement is 6.5 rupas per BPHS ch. 27 sl. 32-33 (BUG-1189, F3)
BPHS ch. 27 (Evaluation of Strengths) sl. 32-33 gives 390, 360, 300, 420, 390,
330 and 300 virupas for Sun..Saturn; the Sun was 5.0. MIN_REQUIRED in
scripts/shadbala.py is the only requirement table in our code (the 5.0 default
in .get() is for unknown bodies; vendored jyotishganit / dashaflow tables
already say 6.5). Upstream yinduzhanxing 0a6696c5 still has 5.0 (to notify).
Product decision 2026-10-02 (added to TASK-upstream-sync4-20261002).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N4f2nya58RoRu4yEmJgRGE
2026-10-02 14:06:23 +08:00

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 MIN_REQUIRED == {planet: value / VIRUPAS_PER_RUPA for planet, value in BPHS_VIRUPAS.items()}
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