test(dasha): keep the upstream boundary contract (upstream 07fc5be3)

A8 is tests only. dasha_analyzer.py is frozen and was not edited. Both contract tests passed.

Co-Authored-By: Grok (agent loop)
This commit is contained in:
jesse-ux
2026-10-28 09:45:09 +08:00
co-authored by Grok (agent loop)
parent 7bede9c99a
commit c1bd59e97a
@@ -0,0 +1,23 @@
"""Dasha analyzer must use the common left-closed Nakshatra partition."""
from fractions import Fraction
import math
from scripts.dasha_analyzer import NAKSHATRA_LIST, lon_to_nakshatra
def test_exact_star_starts_select_the_new_star_with_zero_progress():
for index in range(27):
longitude = float(Fraction(40 * index, 3))
nakshatra, progress, pada = lon_to_nakshatra(longitude)
assert nakshatra == NAKSHATRA_LIST[index]
assert progress == 0.0
assert pada == 1
def test_immediate_preceding_float_stays_in_the_prior_star():
boundary = float(Fraction(40 * 7, 3))
nakshatra, progress, pada = lon_to_nakshatra(math.nextafter(boundary, -math.inf))
assert nakshatra == NAKSHATRA_LIST[6]
assert 0.999999 < progress < 1.0
assert pada == 4