fix(dasha): judge antardasha sandhi from the unclipped start
Upstream 3c2dad95, rewritten for this tree. A birth-clipped antardasha start was reported as a transition. The first mahadasha start stays, because BUG-1268 already stores the real pre-birth boundary there. BUG-1382. Co-Authored-By: Grok (agent loop) Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Grok (agent loop)
Cursor
parent
d11ee6f0dd
commit
5be864a8e4
@@ -0,0 +1,60 @@
|
||||
"""A clipped birth balance is not an actual Dasha transition.
|
||||
|
||||
Upstream ``tests/test_dasha_sandhi_birth_clip.py`` (3c2dad95) skips the first
|
||||
mahadasha start whenever ``is_balance`` is set. This tree does not: BUG-1268
|
||||
already stores the real pre-birth mahadasha boundary in ``start``.
|
||||
|
||||
| 处 | 原值 | 新值 | 原因 |
|
||||
| --- | --- | --- | --- |
|
||||
| 第一大运 ``start`` | ``2000-01-01``,并跳过 ``is_balance`` 起点 | ``1998-01-01``,不跳过 | 我方第一大运起点是出生前的真实交接 |
|
||||
| 断言 | 跳过起点后窗口为空 | 起点超出容限,窗口仍为空 | 单独证明被裁剪的小运起点不算交接 |
|
||||
"""
|
||||
from types import SimpleNamespace
|
||||
|
||||
from scripts.jyotish_engine import _calc_dasha_sandhi, cmd_dasha
|
||||
|
||||
|
||||
def test_birth_clip_does_not_create_a_transition():
|
||||
data = {'timeline': [{'lord': 'Saturn', 'is_balance': True,
|
||||
'start': '1998-01-01', 'end': '2010-01-01',
|
||||
'antardasha_timeline': [{'lord': 'Mercury', 'start': '2000-01-01', 'end': '2002-01-01',
|
||||
'unclipped_start_datetime': '1999-01-01T12:30:00'}]}]}
|
||||
assert _calc_dasha_sandhi(data, '2000-01-01')['sandhi_windows'] == []
|
||||
|
||||
|
||||
def test_actual_unclipped_start_is_still_found():
|
||||
data = {'timeline': [{'lord': 'Saturn', 'is_balance': True,
|
||||
'start': '1998-01-01', 'end': '2010-01-01',
|
||||
'antardasha_timeline': [{'lord': 'Mercury', 'start': '2000-01-01', 'end': '2002-01-01',
|
||||
'unclipped_start_datetime': '1999-12-20T12:30:00'}]}]}
|
||||
windows = _calc_dasha_sandhi(data, '2000-01-01', 30)['sandhi_windows']
|
||||
assert len(windows) == 1
|
||||
assert windows[0]['date'] == '1999-12-20'
|
||||
assert windows[0]['days_from_reference'] == -12
|
||||
|
||||
|
||||
def test_real_boundaries_are_inclusive_at_orb_limit():
|
||||
data = {'timeline': [{'lord': 'Sun', 'start': '2000-01-01', 'end': '2000-02-01'}]}
|
||||
windows = _calc_dasha_sandhi(data, '2000-01-02', 1)['sandhi_windows']
|
||||
assert len(windows) == 1 and windows[0]['date'] == '2000-01-01'
|
||||
|
||||
|
||||
def test_prebirth_mahadasha_start_is_not_discarded():
|
||||
data = {'timeline': [{'lord': 'Saturn', 'is_balance': True,
|
||||
'start': '1999-12-01', 'end': '2010-01-01',
|
||||
'antardasha_timeline': []}]}
|
||||
windows = _calc_dasha_sandhi(data, '2000-01-01', 90)['sandhi_windows']
|
||||
assert [row['date'] for row in windows] == ['1999-12-01']
|
||||
|
||||
|
||||
def test_thirty_day_chart_does_not_list_the_birth_day_as_an_antardasha_join():
|
||||
packet = cmd_dasha(SimpleNamespace(
|
||||
moon_lon=20 / 3, nakshatra=None, pada=None,
|
||||
birthdate='2000-01-01', year=2000, month=1, day=1, hour=12, minute=0, second=0,
|
||||
lat=None, lon=None, tz=0, today='2000-01-31', dasha_year_days=365.25))
|
||||
windows = _calc_dasha_sandhi(packet, '2000-01-31', 30)['sandhi_windows']
|
||||
clipped = [
|
||||
row for row in windows
|
||||
if row['level'] == 'antardasha' and row['boundary'] == 'start' and row['date'] == '2000-01-01'
|
||||
]
|
||||
assert clipped == []
|
||||
Reference in New Issue
Block a user