Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DbBXp2U3BH1SxwAGyhhbe1
40 lines
1.6 KiB
Python
40 lines
1.6 KiB
Python
# BUG-2301: the astrologer's tests/test_yoga_missing_geometry.py at upstream 58f37ee5b, unchanged except this line.
|
|
from pathlib import Path
|
|
import pytest
|
|
from scripts.yoga_engine import YogaEngine, SIGNS, ALL_PLANETS
|
|
|
|
|
|
def detect(rule, houses):
|
|
engine=YogaEngine(str(Path(__file__).resolve().parents[1]/'references/yoga_rules.json'))
|
|
engine.rules=[r for r in engine.rules if r['id']==rule]
|
|
planets={p:{'house':h,'sign':SIGNS[h-1],'degree':(h-1)*30+10}
|
|
for p,h in houses.items() if h is not None}
|
|
return engine.detect(planets,'Aries')
|
|
|
|
|
|
@pytest.mark.parametrize('rule,values',[
|
|
('bvr_samudra_yoga',[2,4,6,8,10,12,2]),
|
|
('bvr_ardha_chandra_yoga',[11,12,1,2,3,4,5]),
|
|
('bvr_trilochana_yoga',[2,6,10,3,4,5,7]),
|
|
])
|
|
def test_supported_geometry_and_missing_input(rule,values):
|
|
houses=dict(zip(ALL_PLANETS[:7],values))
|
|
rows=detect(rule,dict(houses,Rahu=9,Ketu=3))
|
|
assert rows and rows[0]['formation_status']=='conditions_met'
|
|
assert 'Rahu' not in rows[0]['planets']
|
|
houses['Moon']=None
|
|
missing=detect(rule,houses)
|
|
assert missing and all(r.get('formation_status')!='conditions_met' for r in missing)
|
|
|
|
|
|
@pytest.mark.parametrize('rule,values',[
|
|
('bvr_samudra_yoga',[2,2,2,2,2,2,2]),
|
|
('bvr_samudra_yoga',[2,4,6,8,10,12,1]),
|
|
('bvr_ardha_chandra_yoga',[1,2,3,4,5,6,7]),
|
|
('bvr_ardha_chandra_yoga',[2,3,4,5,6,7,7]),
|
|
('bvr_trilochana_yoga',[2,2,2,3,4,5,7]),
|
|
('bvr_trilochana_yoga',[2,6,11,3,4,5,7]),
|
|
])
|
|
def test_partial_or_wrong_geometry_not_promoted(rule,values):
|
|
assert detect(rule,dict(zip(ALL_PLANETS[:7],values)))==[]
|