Owner 2026-11-26 approved items 1-4 (not Rogagrastha, not M10). Frozen jyotish_engine.py / yoga_engine.py / yoga_rules.json changed only for these. Her texts are rewritten without book/author names or disclaimers; Nishkapata keeps its plain meaning instead of a conduct gate that printed another rule's sentence. A combust Budhaditya says Mercury is combust. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DbBXp3RzgZVEpT1PXxkwHj
91 lines
3.6 KiB
Python
91 lines
3.6 KiB
Python
"""Raman220/221 source-object and missing-input regressions, not outcome tests."""
|
|
from copy import deepcopy
|
|
|
|
import pytest
|
|
|
|
from scripts.yoga_engine import YogaEngine, ALL_PLANETS
|
|
# 本站移植说明(BUG-2406):上游 322e2f30 原样复制。本站没有 professional_parity_closure.build_yoga_interpretation_pack
|
|
# (格局页由 pl9_interpretation_packs 生成),依赖它的用例在本站跳过。
|
|
try:
|
|
from scripts.professional_parity_closure import build_yoga_interpretation_pack
|
|
except ImportError:
|
|
build_yoga_interpretation_pack = None
|
|
_NEEDS_UPSTREAM_PACK = pytest.mark.skipif(build_yoga_interpretation_pack is None, reason="upstream pack builder not in this repo")
|
|
|
|
|
|
|
|
def detect(planets, d9=None):
|
|
engine = YogaEngine('references/yoga_rules.json')
|
|
engine.rules = [r for r in engine.rules if r['id'] == 'bvr_bahu_puthra_precise']
|
|
return engine.detect(planets, 'Aquarius', context={'d9': {'planets': d9 or {}}})
|
|
|
|
|
|
def base():
|
|
planets = {p: {'house': 3} for p in ALL_PLANETS}
|
|
planets['Sun'] = {'house': 7} # seventh lord, alone
|
|
return planets
|
|
|
|
|
|
@_NEEDS_UPSTREAM_PACK
|
|
def test_missing_navamsa_is_not_non_saturn_navamsa():
|
|
planets = base()
|
|
planets['Rahu']['house'] = 5
|
|
row = detect(planets)[0]
|
|
assert row['formation_status'] == 'incomplete_conditions'
|
|
assert 'Rahu.D9.sign' in row['missing_inputs']
|
|
assert not row['effects']
|
|
assert not build_yoga_interpretation_pack({'yogas': [row]})['pages'][0]['claim_permissions']['named_formation']
|
|
|
|
|
|
@pytest.mark.parametrize('sign', ['Capricorn', 'Aquarius'])
|
|
def test_known_saturn_navamsa_rejects_first_branch(sign):
|
|
planets = base()
|
|
planets['Rahu']['house'] = 5
|
|
assert detect(planets, {'Rahu': {'sign': sign}}) == []
|
|
|
|
|
|
def test_first_branch_survives_missing_other_branch():
|
|
row = detect({'Rahu': {'house': 5}}, {'Rahu': {'sign': 'Aries'}})[0]
|
|
assert row['formation_status'] == 'conditions_met'
|
|
assert row['formation_evidence']['matched_paths'] == ['raman220']
|
|
assert row['formation_evidence']['unresolved_other_paths']
|
|
|
|
|
|
def test_seventh_lord_cannot_be_its_own_companion():
|
|
planets = base()
|
|
planets['Jupiter']['house'] = 1
|
|
assert detect(planets, {'Sun': {'sign': 'Sagittarius'}}) == []
|
|
|
|
|
|
@_NEEDS_UPSTREAM_PACK
|
|
def test_companion_navamsa_dispositor_not_seventh_lord_dispositor():
|
|
planets = base()
|
|
planets['Mars']['house'] = 7
|
|
planets['Saturn']['house'] = 1
|
|
before = deepcopy(planets)
|
|
row = detect(planets, {'Mars': {'sign': 'Capricorn'}})[0]
|
|
assert planets == before
|
|
assert row['formation_evidence']['matched_paths'] == ['raman221']
|
|
assert set(row['planets']) == {'Sun', 'Mars', 'Saturn'}
|
|
assert row['condition_checks']['raman221']['companions'][0]['dispositor_d1_house'] == 1
|
|
assert '不能' in row['effects'][0]
|
|
page = build_yoga_interpretation_pack({'yogas': [row]}, active_dasha_lords={'Mars'})['pages'][0]
|
|
assert not page['claim_permissions']['event_outcome']
|
|
|
|
|
|
def test_missing_companion_division_is_unknown_and_false_dispositor_is_negative():
|
|
planets = base()
|
|
planets['Mars']['house'] = 7
|
|
row = detect(planets)[0]
|
|
assert row['formation_status'] == 'incomplete_conditions'
|
|
assert 'Mars.D9.sign' in row['missing_inputs']
|
|
assert detect(planets, {'Mars': {'sign': 'Capricorn'}}) == []
|
|
|
|
|
|
def test_two_met_alternatives_remain_one_rule_support():
|
|
planets = base()
|
|
planets.update(Mars={'house': 7}, Saturn={'house': 2}, Rahu={'house': 5})
|
|
row = detect(planets, {'Mars': {'sign': 'Capricorn'}, 'Rahu': {'sign': 'Aries'}})[0]
|
|
assert row['formation_evidence']['matched_paths'] == ['raman220', 'raman221']
|
|
assert row['formation_evidence']['independent_support_count'] == 1
|