Files
Jyotisha/tests/test_functional_yogakaraka_kendra_trikona.py
T
Jesse_ChenandClaude Opus 5.5 57782aea8a feat(functional): adopt upstream BPHS ch.34 profile v2; fix Pancha Mahapurusha self-conjunction; yoga engine reads the same functional roles
Ported verbatim from the upstream skill repo (yinduzhanxing e9beae6b) with
product authorization 2026-10-02: scripts/functional_benefics.py,
scripts/pancha_mahapurusha.py, references/functional-role-profile.md; only
the two functional-role methods of scripts/yoga_engine.py (our file diverged).
v5 77-case rectification eval: 5 cells up (to +7.8pp), one cell -1.3pp (one
case); product accepted. Rectification memoization golden still to be
regenerated (scores change with the grouping).

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

48 lines
2.5 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-1158 (product decisions 2026-10-02): yogakaraka needs a kendra among 4/7/10
AND a trikona among 5/9; grouping follows the upstream BPHS ch.34 profile v2."""
from __future__ import annotations
import pytest
from scripts.functional_benefics import SIGNS, derive_functional_benefic_malefic
YOGAKARAKAS = {
"Aries": [], "Taurus": ["Saturn"], "Gemini": [], "Cancer": ["Mars"], "Leo": ["Mars"], "Virgo": [],
"Libra": ["Saturn"], "Scorpio": [], "Sagittarius": [], "Capricorn": ["Venus"], "Aquarius": ["Venus"], "Pisces": [],
}
# 原值: 窄修后分组与 v1 相同,非日月命主一律留在 functional_benefics(test_lagna_lord_stays_benefic)
# 新值: 分组改用上游 yinduzhanxing e9beae6b 的 bphs_ch34_general_with_sign_exceptions_v2:
# BPHS 第 34 章明文点名的上升 / 星按 ROLE_OVERRIDES 定(白羊火星中性、金牛金星凶、天秤金星中性、
# 天蝎火星中性、射手木星中性),12 宫主不再一律判凶;其余命主仍为吉
# 原因: 产品 2026-10-02 决定改用上游版功能吉凶(以生时校正 77 例评测不降超过 1 个百分点为前提),
# 见 references/functional-role-profile.md 与 BUG-1158
from scripts.functional_benefics import ROLE_OVERRIDES # noqa: E402
LAGNA_LORDS = {
"Aries": "Mars", "Taurus": "Venus", "Gemini": "Mercury", "Virgo": "Mercury", "Libra": "Venus",
"Scorpio": "Mars", "Sagittarius": "Jupiter", "Capricorn": "Saturn", "Aquarius": "Saturn", "Pisces": "Jupiter",
}
@pytest.mark.parametrize("sign", sorted(LAGNA_LORDS))
def test_lagna_lord_role_follows_profile(sign: str) -> None:
result = derive_functional_benefic_malefic(sign)
lord = LAGNA_LORDS[sign]
expected = ROLE_OVERRIDES.get(sign, {}).get(lord, "benefic")
assert lord in result[f"functional_{expected}s"], (sign, lord, expected)
assert result["profile"] == "bphs_ch34_general_with_sign_exceptions_v2"
@pytest.mark.parametrize("sign", SIGNS)
def test_sign_overrides_win(sign: str) -> None:
result = derive_functional_benefic_malefic(sign)
for planet, role in ROLE_OVERRIDES.get(sign, {}).items():
assert planet in result[f"functional_{role}s"], (sign, planet, role)
def test_sole_twelfth_lord_is_not_automatically_malefic() -> None:
# Virgo: the Sun owns only the 12th; Leo: the Moon owns only the 12th.
assert "Sun" not in derive_functional_benefic_malefic("Virgo")["functional_malefics"]
assert "Moon" not in derive_functional_benefic_malefic("Leo")["functional_malefics"]