test: lock Goel node policy, tied degrees, and raw longitudes

Issue #94 T4. Wired jaimini output keeps both node policies, blocks equal seven-planet degrees without an Atmakaraka or a rank, and full-reading passes chart degree_raw into Goel within 1e-6 degrees.

Co-Authored-By: Grok (agent loop)
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
jesse-ux
2026-10-22 00:57:58 +08:00
co-authored by Grok (agent loop) Cursor
parent a1c7f6ce67
commit a769533032
+75
View File
@@ -132,3 +132,78 @@ def test_jaimini_special_entry_exposes_real_goel_results(monkeypatch):
assert result.get('goel_full_strength', {}).get('atmakaraka') == 'Sun'
assert result['goel_special_points']['Brahma']['value'] == 'Jupiter'
assert result['niryaana_shoola_strength']['deprecated'] is True
def test_wired_special_entry_keeps_both_node_policies(monkeypatch):
from types import SimpleNamespace
from scripts import jyotish_engine as engine
chart = {'planets': {p: {'degree': round(v, 4), 'degree_raw': v} for p, v in SYNTHETIC.items()},
'ascendant': {'degree': 0., 'lon': 0.}}
chart['planets']['Sun']['degree'] = 1.0
monkeypatch.setattr(engine, '_compute_chart_from_args', lambda args: (chart, 0, 2451545., 24.))
result = engine.cmd_jaimini(SimpleNamespace(mode='special', hour=12, minute=0))
strength = result['goel_full_strength']
assert strength['status'] == 'executed'
assert strength['node_occupancy_policy'] == 'include_nodes_text'
exclusion = strength['worked_example_node_exclusion']
assert exclusion['node_occupancy_policy'] == 'exclude_nodes_worked_example'
assert strength['atmakaraka'] == 'Sun'
assert abs(strength['planets']['Sun']['degree_in_sign'] - (SYNTHETIC['Sun'] % 30)) <= 1e-6
def test_wired_equal_degrees_block_without_atmakaraka_or_rank(monkeypatch):
from types import SimpleNamespace
from scripts import jyotish_engine as engine
positions = dict(SYNTHETIC, Moon=59.)
chart = {'planets': {p: {'degree': v} for p, v in positions.items()},
'ascendant': {'degree': 0.}}
monkeypatch.setattr(engine, '_compute_chart_from_args', lambda args: (chart, 0, 2451545., 24.))
result = engine.cmd_jaimini(SimpleNamespace(mode='special', hour=12, minute=0))
strength = result['goel_full_strength']
assert strength['status'] == 'blocked'
assert strength['reason'] == 'equal_degree_seven_karaka_rank_requires_finer_positions'
assert 'atmakaraka' not in strength
assert 'planets' not in strength
for name in ('Brahma', 'Maheshwara', 'Rudra'):
point = result['goel_special_points'][name]
assert point['status'] == 'blocked'
assert 'value' not in point
assert 'candidates' not in point
def test_full_reading_feeds_goel_degree_raw(monkeypatch):
import scripts.goel_jaimini_strength as goel
from scripts.jyotish_engine import cmd_full_reading
captured = []
real = goel.build_goel_chart_evidence
def wrapped(longitudes, ascendant):
captured.append(dict(longitudes))
return real(longitudes, ascendant)
monkeypatch.setattr(goel, 'build_goel_chart_evidence', wrapped)
report = cmd_full_reading(type('Args', (), {
'name': 'fictional',
'year': 1990, 'month': 1, 'day': 1, 'hour': 12, 'minute': 0, 'second': 0,
'lat': 39.9, 'lon': 116.4, 'tz': 8.0,
'node_mode': 'mean', 'ayanamsa': 'lahiri',
'today': '2026-10-22', 'transit_date': '2026-10-22',
'target_year': 2026, 'age': 36,
'birth_time_accuracy': 'confirmed',
})())
assert captured, 'full-reading did not call Goel'
planets = report['modules']['chart']['planets']
expected = {
name: pdata['degree_raw']
for name, pdata in planets.items()
if isinstance(pdata, dict) and 'degree_raw' in pdata
}
assert expected
for longitudes in captured:
assert set(longitudes) == set(expected)
for name, raw in expected.items():
assert abs(float(longitudes[name]) - float(raw)) <= 1e-6
strength = report['modules']['jaimini']['goel_full_strength']
assert strength['status'] == 'executed'
assert strength['node_occupancy_policy'] == 'include_nodes_text'
assert strength['worked_example_node_exclusion']['node_occupancy_policy'] == 'exclude_nodes_worked_example'