Files
Jyotisha/tests/test_saham_directed_operand_contract.py
T
jesse-uxGrok (agent loop)Cursor
2f8263b6ac fix(saham): add 30 degrees when the third operand misses the B-to-A arc
Upstream ce9fed15. The exception now tests C on the forward arc from B to A, in both the value and the trace. BUG-1387.

Co-Authored-By: Grok (agent loop)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-18 16:44:43 +08:00

27 lines
1.1 KiB
Python

import pytest
from scripts import tajika
@pytest.mark.parametrize('sun,moon,asc,expected,exception', [
(45, 120, 10, 115, True),
(45, 120, 60, 135, False),
(200, 100, 50, 310, False),
(200, 100, 150, 80, True),
])
def test_punya_matches_pvr_directed_arc(sun, moon, asc, expected, exception):
points = {'Sun': sun, 'Moon': moon}
assert tajika._calc_formula_saham('Punya_Saham', points, asc, True, {}) == expected
result = tajika._formula_saham_trace('Punya_Saham', points, asc, True, {})
assert result['longitude'] == expected
assert result['zodiacal_order_exception_applied'] is exception
def test_third_operand_is_used_even_when_not_ascendant(monkeypatch):
monkeypatch.setitem(tajika._SAHAM_RULES['sahams'], 'TestThird', {
'formula_day': ['Jupiter', 'Moon', 'Venus'],
'formula_night': ['Moon', 'Jupiter', 'Venus'],
})
points = {'Jupiter': 200., 'Moon': 50., 'Venus': 100.}
assert tajika._calc_formula_saham('TestThird', points, 60., True, {}) == 250.
assert tajika._calc_formula_saham('TestThird', points, 60., False, {}) == 340.