Files
Jyotisha/tests/test_upstream_sync9_ashtottari_reference_clock.py
T
jesse-uxandGrok (agent loop) b35c424945 fix(ashtottari): source arcs and a shifted sub-period clock (BUG-1475, upstream 0712f98f)
Rahu uses the circular unique start. Output keys are unchanged. Upstream arc and clock tests passed.

Co-Authored-By: Grok (agent loop)
2026-10-28 09:45:07 +08:00

35 lines
1.4 KiB
Python

from datetime import datetime, timedelta
from scripts.ashtottari_dasha import calculate_ashtottari_dasha
def calculate(reference):
return calculate_ashtottari_dasha({
'birth_datetime':'2000-01-01T12:34:56',
'moon_nakshatra_index':3, 'is_shukla_paksha':False,
'as_of':reference.isoformat()})
def test_exact_boundary_uses_next_period_and_preserves_seconds():
birth=datetime(2000,1,1,12,34,56)
first=calculate(birth)['major'][0]
boundary=datetime.fromisoformat(first['end_date'])
assert calculate(boundary-timedelta(microseconds=1))['current']['planet']==first['planet']
assert calculate(boundary)['current']['planet']!=first['planet']
assert calculate(birth-timedelta(seconds=1))['current'] is None
def test_second_cycle_children_move_with_their_parent():
birth=datetime(2000,1,1,12,34,56)
shift=timedelta(days=108*365.25)
result=calculate(birth+shift)
current=result['current']
assert current['cycle_number']==2
assert current['start_date']==(birth+shift).isoformat()
assert current['antardasha'][0]['start_date']==current['start_date']
assert current['antardasha'][-1]['end_date']==current['end_date']
for ad in current['antardasha']:
assert ad['pratyantardasha'][0]['start_date']==ad['start_date']
assert ad['pratyantardasha'][-1]['end_date']==ad['end_date']
assert result['major'][0]['start_date']==birth.isoformat()