Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DbBXp2U3BH1SxwAGyhhbe1
34 lines
1.6 KiB
Python
34 lines
1.6 KiB
Python
# BUG-2301: the astrologer's tests/test_yoga_pisacha_source.py at upstream 58f37ee5b, unchanged except this line.
|
|
from scripts.yoga_engine import ALL_PLANETS, YogaEngine
|
|
|
|
|
|
def run(changes=None, phase=False):
|
|
p = {name: {'house': 3} for name in ALL_PLANETS}
|
|
p.update(Moon={'house': 1}, Rahu={'house': 1}, Saturn={'house': 2})
|
|
p.update(changes or {})
|
|
e = YogaEngine('references/yoga_rules.json')
|
|
e.rules = [r for r in e.rules if r['id'] == 'bvr_pisacha_grastha_yoga']
|
|
return e.detect(p, 'Aries', context={'panchanga': {'is_waning_moon': phase}})
|
|
|
|
|
|
def test_conjunction_alone_does_not_supply_trine_condition():
|
|
assert run() == []
|
|
assert run({'Mars': {'house': 5}}) == []
|
|
row = run({'Mars': {'house': 5}, 'Sun': {'house': 9}})[0]
|
|
assert row['formation_evidence']['matched_paths'] == ['definition_both_non_lagna_trines']
|
|
assert not row['effects'] and 'effects_en' not in row
|
|
|
|
|
|
def test_remarks_saturn_aspect_and_conjunction_are_separate_named_path():
|
|
row = run({'Moon': {'house': 4}, 'Rahu': {'house': 4}, 'Saturn': {'house': 10}})[0]
|
|
assert row['formation_evidence']['matched_paths'] == ['remarks_saturn_contact']
|
|
assert run({'Moon': {'house': 4}, 'Rahu': {'house': 4}, 'Saturn': {'house': 4}})
|
|
assert not run({'Moon': {'house': 4}, 'Rahu': {'house': 5}, 'Saturn': {'house': 4}})
|
|
|
|
|
|
def test_missing_definition_phase_does_not_cancel_positive_remarks():
|
|
row = run({'Saturn': {'house': 1}}, phase=None)[0]
|
|
assert row['formation_status'] == 'conditions_met'
|
|
assert row['formation_evidence']['unresolved_other_paths']
|
|
assert run(phase=None)[0]['formation_status'] == 'incomplete_conditions'
|