Files
Jyotisha/tests/test_annual_strength_five_fold.py
T
Jesse_ChenandClaude Opus 5.5 a6cf8f8f7a feat(tajika): annual strength layer uses the Tajika five-fold Panchavargiya (BUG-1222)
Product decision 2026-10-03: the annual Harsha / Panchavargiya strength
layer's Panchavargiya column is the same `_calc_native_panchavargiya_bala`
score the year-lord selection compares (BUG-1217): five components, score
out of 20, labelled 「Tajika 五分力量」 / "Tajika five-fold strength". The
unreachable dignity-proxy block is removed; Harsha Bala unchanged; the
combined figure stays blocked (not ruled).

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

69 lines
3.0 KiB
Python

"""BUG-1222: the annual strength layer and the year-lord selection use one score.
Product 2026-10-03 (TASK-astrologer-rulings-batch4-20261003 T2): the annual
「Harsha / Panchavargiya」 strength layer's Panchavargiya column is the Tajika
five-fold strength (`_calc_native_panchavargiya_bala`) the year-lord
selection compares (BUG-1217), not the D1/D2/D3/D9/D12 dignity proxy.
Fictional birth data only.
"""
from __future__ import annotations
import os
import sys
import pytest
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path[:0] = [ROOT, os.path.join(ROOT, "scripts")]
import solar_return # noqa: E402
pytest.importorskip("swisseph")
# Fictional births (no real person); several target years so the shortlist
# branches differ.
BIRTHS = (
(1990, 6, 15, 12, 0, 28.6, 77.2, 5.5),
(1975, 11, 2, 4, 30, 40.7, -74.0, -5.0),
(2001, 2, 20, 21, 10, 51.5, -0.1, 0.0),
)
@pytest.mark.parametrize("birth", BIRTHS)
@pytest.mark.parametrize("target_year", (2025, 2026))
def test_strength_table_and_year_lord_share_the_five_fold_score(birth, target_year):
report = solar_return.solar_return_full_report(*birth, target_year, ayanamsa_name="raman")
strength = report["tajika_strength"]
year_lord = report["year_lord"]
candidates = year_lord.get("candidates") or []
assert candidates, year_lord
assert year_lord["panchavargiya_engine"] == "tajika_native_five_fold"
for candidate in candidates:
row = strength["panchavargiya_bala"][candidate["planet"]]
assert row["status"] == "usable"
assert row["engine"] == "tajika_native_five_fold"
assert row["score"] == candidate["panchavargiya_score"], candidate["planet"]
assert row["raw_total"] == candidate["panchavargiya_raw_total"], candidate["planet"]
assert row["components"] == candidate["panchavargiya_components"], candidate["planet"]
lord = year_lord["year_lord"]
chosen = next(item for item in candidates if item["planet"] == lord)
assert strength["panchavargiya_bala"][lord]["score"] == chosen["panchavargiya_score"]
def test_strength_layer_has_no_dignity_proxy_fields():
report = solar_return.solar_return_full_report(*BIRTHS[0], 2026, ayanamsa_name="raman")
strength = report["tajika_strength"]
assert strength["panchavargiya_method"] == "Tajika 五分力量"
assert strength["panchavargiya_method_en"] == "Tajika five-fold strength"
for row in strength["panchavargiya_bala"].values():
# The proxy's D-chart components (rasi / hora / dwadasamsa …) are gone.
assert set(row["components"]) == {"graha_bala", "uchcha_bala", "hudda_bala", "drekkana_bala", "navamsha_bala"}
assert row["max_score"] == 20.0
assert 0 <= row["score"] <= 20.0
assert row["score"] == pytest.approx(row["raw_total"] / 4, abs=0.01)
# Harsha Bala keeps its own shape and scale.
for row in strength["harsha_bala"].values():
assert row["status"] == "usable"
assert row["max_score"] == 15.0