Files
Jyotisha/tests/test_downstream_use_r3.py
T
ClaudeandClaude Opus 5.5 198208ac5b feat(sync): astrologer handoff 2e5485f5 — Sodhita entry, Narayana strength profile, 71 unimplemented yogas, Argala tie, Bhava relative points
- A1: ashtakavarga_shodhana.calc_sodhita_av (her entry; ashtakavarga.py frozen),
  level=not_calibrated + prediction_scoring_allowed=False on the chain; legacy
  subtraction stays removed (BUG-1209).
- A2: select_narayana_seed_sign strength_profile rath_empty_sign_lord_strength_v1,
  shared by source-aware seed, MD and AD (matches her function on 6000 draws).
- A3: preflight of logical branches; placeholder not an implementation;
  reference_only rules listed; 71 not_implemented; cmd_yoga not_implemented_count.
- A4: neechabhanga_kendra name/category per her handoff.
- 9e971559: Vimshottari AD record lord and native current PD in dasa convergence.
- B10: Argala equal count stays strength_comparison_required (no Narayana borrow).
- B11: full-reading bhava_bala.reference_relative_points, labelled
  product_relative_points_not_traditional, no bands.

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

92 lines
5.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.
#!/usr/bin/env python3
"""占星师第三轮审查 2026-11-07, item 4: downstream use of Ashtakavarga, Shadbala,
Argala and Tajika values (the producers are not changed here)."""
from __future__ import annotations
import os
import sys
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path[:0] = [ROOT, os.path.join(ROOT, "scripts")]
import annual_tajika_pack # noqa: E402
import consultation_native_layers as cnl # noqa: E402
import mcp_server # noqa: E402
import shadbala_chesta_profiles as chesta # noqa: E402
from annual_service import report_facts # noqa: E402
def test_sodhita_values_never_become_a_wealth_friction_signal() -> None:
# 原值: 2、11 宫 Sodhita 都 <= 19 → obstructive / sodhita_wealth_friction(旧 calc_sodhita_av 的阈值)
# 新值: 任何数值都只列出,level=none,status=reference_only,标尺度
# 原因: 占星师第三轮审查 2026-11-07
for score in (0, 5, 19, 40):
av = {"sodhita": {"sodhita_sav": {"assessment": [
{"sign": "Taurus", "score": score}, {"sign": "Aquarius", "score": score}]}}}
row = mcp_server._derive_sodhita_finance_support(av, "Aries")
assert row["level"] == "none" and row["signals"] == []
assert row["scale"] == "sodhita_sav_trikona_ekadhipatya"
assert row["raw_scores"] == {"2": score, "11": score}
def test_annual_shadbala_facts_separate_total_rank_and_sufficiency_ratio() -> None:
# 原值: ranking + ratio,未写排名依据;比值无说明
# 新值: ranking_basis=总 Rupa;ratio_meaning=达标比(不是吉凶、不是 Ishta Phala);另给 ranking_by_ratio
# 原因: 占星师第三轮审查 2026-11-07
field = {"status": "computed", "ranking": ["Sun", "Moon"], "strongest": "Sun", "weakest": "Moon",
"planets": {"Sun": {"total_rupas": 7.0, "min_required": 6.5},
"Moon": {"total_rupas": 6.6, "min_required": 5.0}}}
facts = report_facts._year_shadbala(field)
assert facts["ranking"] == ["Sun", "Moon"] and facts["ranking_basis"].startswith("total_rupas")
assert facts["ranking_by_ratio"] == ["Moon", "Sun"] # Moon 6.6 / 5.0 = 1.32 > Sun 7.0 / 6.5 = 1.08
assert "not auspiciousness" in facts["ratio_meaning"] and "ishta_phala" in facts["ratio_meaning"]
def test_chesta_reference_rows_say_they_are_not_this_chart() -> None:
# 原值: planet_rows 每行只有固定案例值,只在列表外有 planet_rows_scope
# 新值: 每行 values_scope=reference_packet_chart_not_this_chart(查单颗星时也能看到)
# 原因: 占星师第三轮审查 2026-11-07
candidates = chesta.build_chesta_profile_candidates()
rows = candidates["planet_rows"]
assert rows and all(row["values_scope"] == chesta.VALUES_SCOPE for row in rows)
preview = chesta.build_chesta_target_preview("pyjhora_jhora_replay_target")
assert all(row["values_scope"] == chesta.VALUES_SCOPE for row in preview["rows"])
def test_argala_supported_is_labelled_structural_and_ties_stay_unresolved() -> None:
# 原值: net_result=supported / 支持,无含义说明;Narayana 强弱选择器裁决同数无标记
# 新值: net_result_meaning 写明只是结构干预;同数不择胜(strength_comparison_required / 待定),无 tie_break_ruling_pending
# 原因: 占星师第三轮审查 2026-11-07;占星师 2026-11-07 rulings.md B10:同数借用 Narayana 强弱无原典依据
signs = ["Aries", "Taurus", "Gemini", "Cancer", "Leo", "Virgo", "Libra", "Scorpio",
"Sagittarius", "Capricorn", "Aquarius", "Pisces"]
# 2nd from Aries lagna (Taurus) has one planet, the 12th (Pisces) one blocker: a tie.
placement = {"Sun": "Taurus", "Moon": "Pisces", "Mars": "Leo", "Mercury": "Virgo",
"Jupiter": "Libra", "Venus": "Scorpio", "Saturn": "Capricorn"}
chart = {"ascendant": {"sign": "Aries"},
"planets": {name: {"sign": sign, "house": signs.index(sign) + 1} for name, sign in placement.items()}}
layer = cnl.build_argala(chart)
assert "not that matters go smoothly" in layer["net_result_meaning"]
first = layer["houses"]["house_1"]
pair = first["primary"]["H2"]
assert pair["comparison_status"] == "strength_comparison_required" and pair["effective"] is None
assert "ruling_pending" not in pair["strength_comparison"]
assert "tie_break_ruling_pending" not in first
assert first["net_result"] == "strength_comparison_required" and first["verdict_label"] == "待定"
def test_tajika_partial_verified_names_what_it_covers_and_no_date_inherits_it() -> None:
# 原值: 各字段只有 partial_verified,Mudda 日期没有外部回放却同标
# 新值: verification_scope(formula / order / boundary_dates / full_chart);verified_parts 只列有裁决的部分;
# dates_verified=False
# 原因: 占星师第三轮审查 2026-11-07
pack = {"mudda_dasha": {"status": "partial_verified"}, "solar_return": {"status": "partial_verified"},
"patyayini_dasha": {"status": "blocked"}, "monthly_windows": [{"index": 1}]}
annual_tajika_pack._attach_verification_scope(pack, None)
mudda = pack["mudda_dasha"]
assert mudda["verified_parts"] == ["formula"] and mudda["dates_verified"] is False
assert mudda["verification_scope"]["boundary_dates"].startswith("not_externally_replayed")
assert pack["solar_return"]["verified_parts"] == []
assert "verification_scope" not in pack["patyayini_dasha"]
assert pack["monthly_windows"][0]["dates_status"] == "not_externally_replayed"