From c1bd59e97a76e914b884b650cae1adfb13b1e858 Mon Sep 17 00:00:00 2001 From: jesse-ux Date: Wed, 28 Oct 2026 09:45:09 +0800 Subject: [PATCH] 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) --- ..._sync9_dasha_analyzer_boundary_contract.py | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tests/test_upstream_sync9_dasha_analyzer_boundary_contract.py diff --git a/tests/test_upstream_sync9_dasha_analyzer_boundary_contract.py b/tests/test_upstream_sync9_dasha_analyzer_boundary_contract.py new file mode 100644 index 00000000..811d2bab --- /dev/null +++ b/tests/test_upstream_sync9_dasha_analyzer_boundary_contract.py @@ -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