Files
Jyotisha/tests/test_annual_strength_five_fold.py
T
ClaudeandClaude Opus 5.5 178e6d6216 feat(annual): sync Tajika named-yoga inputs, special points, Mudda profiles and Harsha with the astrologer's upstream
产品 2026-11-07 与占星师上游年运同步 (yinduzhanxing 5fb8379c):
- tajika_named_yogas gets upstream's full producer inputs (annual house,
  Harsha+Panchavargiya grade, Tajika rasi relation, lagnesh/karyesh); listed
  only, not judgment factors (3509ccd7). combined_strength stays blocked.
- annual_special_points: annual AL, Bhrigu Bindu, Gulika (upstream port).
- mudda_profiles: moon_at_birth_time (default, BUG-1216 ruling),
  moon_in_varshaphala, without_dasha_balance (upstream pl9-export profile).
- Harsha Bala: PVR 28.3 four-source native rule (upstream native function);
  PyJHora never runs.
- Carried into annual package blocks, report facts year overview, the
  consultation annual layer and nativeAnnualKeys; golden recaptured; English
  reader titles the special-points section.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbBXoyn7Hj3LCW3BUs5bZ8
2026-11-07 16:56:46 +08:00

73 lines
3.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.
"""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 本地启发式,满分 15(max_score == 15.0)
# 新值:Harsha 用 PVR 28.3 四项法(每项 0 或 5),满分 20,分数只能是 0/5/10/15/20
# 原因:产品 2026-11-07 与占星师上游年运同步
for row in strength["harsha_bala"].values():
assert row["status"] == "usable"
assert row["max_score"] == 20.0
assert row["score"] in {0.0, 5.0, 10.0, 15.0, 20.0}
assert row["components"]["rule_profile"] == "pl9_tajika_harsha_four_bala_0_or_5"