Files
Jyotisha/tests/test_functional_role_table.py
ClaudeandClaude Opus 5.5 5d64f71b81 fix: astrologer round-5 rulings 2/3/4/5/10/13 (BUG-1746..1752)
- Functional default = PVR Table 30 (functional_profile=pvr_table_30); the former
  product table is bphs_exception_profile, scored only when named (rectification
  names it, scores unchanged). profile_divergence shows both roles side by side;
  movable-lagna Moon by the table's paksha note; dual-lordship note; prior rulings
  BUG-1570/1590/#166 Q4 checked against Table 30.
- Shadbala: six open items labelled parameter_sensitive; every option combination
  computed; only planets whose pass/fail flips get minimum_check=parameter_sensitive.
- Vimshottari AD/PD rows carry parent_period_start / visible_period_start; the
  consult card cuts the balance MD from its full parent and clips at birth.
- KP DBA: full first parent, clipped at birth (no balance rescale).
- Mudda: balance fields + balance_method (angle default, time comparison apart),
  nominal_year_days, her crossing wording; Harsha combined blocked reason lists items.
- D30 _meta describes the unequal parts (as her r40).
- Golden recaptured with TTL=0.

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

42 lines
1.9 KiB
Python

"""Functional role table (issue #163): a layout of the v2 profile, never a reclassification."""
from __future__ import annotations
import sys
from pathlib import Path
import pytest
ROOT = Path(__file__).resolve().parents[1]
for path in (ROOT, ROOT / "scripts"):
if str(path) not in sys.path:
sys.path.insert(0, str(path))
from functional_benefics import SIGNS, derive_functional_benefic_malefic # noqa: E402
from chart_view_points.functional_roles import functional_role_table # noqa: E402
from yoga_engine import badhaka_house # noqa: E402
@pytest.mark.parametrize("sign", SIGNS)
def test_every_lagna_mirrors_the_profile(sign):
base = derive_functional_benefic_malefic(sign)
table = functional_role_table(sign)
rows = {row["planet"]: row for row in table["rows"]}
for planet in ("Sun", "Moon", "Mars", "Mercury", "Jupiter", "Venus", "Saturn"):
# 原值:不在吉 / 凶表里一律 "neutral"。新值:三表都不在(PVR 表 30 不列动星座上升的月亮、盈亏未给)为 "pending"。
# 原因:占星师 2026-11-08 第五轮裁定 3(默认 PVR 表 30)
expected = ("benefic" if planet in base["functional_benefics"] else "malefic" if planet in base["functional_malefics"]
else "neutral" if planet in base["functional_neutrals"] else "pending")
assert rows[planet]["functional"] == expected
assert rows[planet]["owned_houses"] == base["owned_houses"][planet]
assert ({"key": "yogakaraka"} in rows[planet]["identities"]) == (planet in base["yogakarakas"])
for node in ("Rahu", "Ketu"):
assert rows[node]["functional"] == "pending"
badhaka = [planet for planet, row in rows.items() if any(item["key"] == "badhaka" for item in row["identities"])]
assert len(badhaka) == 1
assert rows[badhaka[0]]["owned_houses"].count(badhaka_house(sign)) == 1
def test_unknown_lagna_blocks():
assert functional_role_table("Nowhere")["status"] == "blocked"