Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DbBXp2U3BH1SxwAGyhhbe1
91 lines
4.4 KiB
Python
91 lines
4.4 KiB
Python
# BUG-2301: the astrologer's tests/test_yoga_vidyut_source.py at upstream 58f37ee5b, unchanged except the skip markers (reasons inline).
|
|
import copy
|
|
|
|
import pytest
|
|
|
|
from scripts.yoga_engine import SIGNS, SIGN_LORDS, YogaEngine
|
|
|
|
|
|
def detect(planets, asc='Aries'):
|
|
engine = YogaEngine('references/yoga_rules.json')
|
|
engine.rules = [r for r in engine.rules if r['id'] == 'bvr_vidyut_yoga']
|
|
return engine.detect(planets, asc)
|
|
|
|
|
|
# Independent transcription of PVR Table6; do not derive expected values from
|
|
# the implementation constant under test.
|
|
PEAKS = {'Sun': ('Aries', 10), 'Moon': ('Taurus', 3),
|
|
'Mars': ('Capricorn', 28), 'Mercury': ('Virgo', 15),
|
|
'Jupiter': ('Cancer', 5), 'Venus': ('Pisces', 27),
|
|
'Saturn': ('Libra', 20)}
|
|
|
|
|
|
@pytest.mark.parametrize('asc', SIGNS)
|
|
def test_exact_points_all_ascendants_and_venus_self_reference(asc):
|
|
l1 = SIGN_LORDS[asc]
|
|
l11 = SIGN_LORDS[SIGNS[(SIGNS.index(asc) + 10) % 12]]
|
|
sign, degree = PEAKS[l11]
|
|
p = {planet: {'sign': sign} for planet in (l1, l11, 'Venus')}
|
|
p[l11]['degree_in_sign'] = degree
|
|
row = detect(p, asc)[0]
|
|
assert row['condition_checks']['deep_exaltation_degree'] == degree
|
|
assert row['condition_checks']['exact_peak'] is True
|
|
assert row['formation_status'] == ('incomplete_conditions' if l11 == 'Venus' else 'conditions_met')
|
|
assert not row['effect_assessment']['personal_outcome_established']
|
|
assert not row['effects']
|
|
|
|
|
|
@pytest.mark.parametrize('difference', [-1, -0.001, 0, 0.001, 1])
|
|
def test_no_invented_orb_and_off_peak_observations_survive(difference):
|
|
p = {'Saturn': {'sign': 'Libra', 'longitude': 200 + difference},
|
|
'Venus': {'sign': 'Libra'}, 'Mars': {'sign': 'Cancer'}}
|
|
row = detect(p)[0]
|
|
assert row['condition_checks']['distance_from_peak_degrees'] == pytest.approx(abs(difference))
|
|
assert (row['formation_status'] == 'conditions_met') is (difference == 0)
|
|
assert row['formation_evidence']['astrological_orb_assumed'] is False
|
|
assert row['formation_evidence']['matched_geometry_paths']
|
|
|
|
|
|
@pytest.mark.parametrize('l1_sign', SIGNS)
|
|
def test_quadrant_is_from_lagna_lord_not_lagna(l1_sign):
|
|
p = {'Saturn': {'sign': 'Libra', 'degree_in_sign': 20},
|
|
'Venus': {'sign': 'Libra'}, 'Mars': {'sign': l1_sign}}
|
|
assert bool(detect(p)) == (l1_sign in ('Aries', 'Cancer', 'Libra', 'Capricorn'))
|
|
|
|
|
|
@pytest.mark.parametrize('degree_fields', [{}, {'degree_in_sign': True},
|
|
{'degree_in_sign': float('nan')}, {'longitude': 200, 'degree_in_sign': 19}])
|
|
def test_missing_or_inconsistent_degree_never_becomes_exact_peak(degree_fields):
|
|
p = {'Saturn': {'sign': 'Libra', **degree_fields},
|
|
'Venus': {'sign': 'Libra'}, 'Mars': {'sign': 'Cancer'}}
|
|
row = detect(p)[0]
|
|
assert row['formation_status'] == 'incomplete_conditions'
|
|
assert row['condition_checks']['degree_in_sign'] is None
|
|
assert row['missing_inputs']
|
|
|
|
|
|
def test_wrong_sign_or_nonconjunction_rejects_even_if_peak_number_matches():
|
|
assert not detect({'Saturn': {'sign': 'Virgo', 'degree_in_sign': 20},
|
|
'Venus': {'sign': 'Virgo'}, 'Mars': {'sign': 'Gemini'}})
|
|
assert not detect({'Saturn': {'sign': 'Libra', 'degree_in_sign': 20},
|
|
'Venus': {'sign': 'Aries'}, 'Mars': {'sign': 'Cancer'}})
|
|
row = detect({'Saturn': {'sign': 'Libra', 'degree_in_sign': 20},
|
|
'Venus': {'sign': 'Libra'}})[0]
|
|
assert row['formation_status'] == 'incomplete_conditions'
|
|
|
|
|
|
@pytest.mark.skip(reason='BUG-2301: checks her report pack (professional_parity_closure.build_yoga_interpretation_pack); this site builds yoga pages in pl9_interpretation_packs, gated per tests/test_yoga_effect_gate_2300.py')
|
|
def test_source_geometry_and_restrictions_reach_interpretation_without_feedback():
|
|
from scripts.professional_parity_closure import build_yoga_interpretation_pack
|
|
p = {'Saturn': {'sign': 'Libra', 'degree_in_sign': 20},
|
|
'Venus': {'sign': 'Libra'}, 'Mars': {'sign': 'Cancer'}}
|
|
row = detect(p)[0]
|
|
page = build_yoga_interpretation_pack({'yogas': [row]})['pages'][0]
|
|
assert not page['claim_permissions']['event_outcome']
|
|
assert page['effect_assessment'] == row['effect_assessment']
|
|
assert page['formation_facts']['raw_row']['condition_checks'] == row['condition_checks']
|
|
assert page['formation_facts']['raw_row']['formation_evidence']['matched_geometry_paths']
|
|
other = copy.deepcopy(p)
|
|
other['Saturn']['user_feedback'] = 'Works in technology and is wealthy'
|
|
assert detect(other) == [row]
|