Ported from yinduzhanxing 0afa2780 (algorithm hunks and its four regression tests; the PyJHora / profile-metadata hunks do not apply to our file). The archived-PyJHora Kala test follows upstream's rewrite. The V.P. Jain benchmark expectations still need the three-column update (follow-up in this branch). TASK-upstream-sync4-20261002 T3. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N4f2nya58RoRu4yEmJgRGE
32 lines
1.1 KiB
Python
32 lines
1.1 KiB
Python
import pytest
|
|
|
|
from scripts.shadbala import chesta_from_longitudes as circular_chesta
|
|
|
|
|
|
@pytest.mark.parametrize("rotation", range(0, 360, 15))
|
|
def test_strength_does_not_depend_on_choice_of_zodiac_origin(rotation):
|
|
# Mean350/true10 must average to0, not180. Apogee180 gives full strength.
|
|
angles = [(angle + rotation) % 360 for angle in (350, 10, 180)]
|
|
assert circular_chesta(*angles) == 60
|
|
|
|
|
|
def test_midpoint_is_continuous_across_zero_and_full_turns():
|
|
assert circular_chesta(359.9999, 10, 180) == circular_chesta(.0001, 10, 180)
|
|
assert circular_chesta(-10, 370, 540) == circular_chesta(350, 10, 180)
|
|
|
|
|
|
def test_does_not_guess_an_antipodal_branch():
|
|
with pytest.raises(ValueError, match="Antipodal"):
|
|
circular_chesta(0, 180, 90)
|
|
|
|
|
|
@pytest.mark.parametrize("mean,true,apogee,expected", [
|
|
(266.34, 229.50, 181.23, 22.23),
|
|
(181.23, 181.52, 174.49, 2.29),
|
|
(66.91, 84.01, 181.23, 35.26),
|
|
(181.23, 171.16, 158.35, 5.95),
|
|
(111.23, 124.39, 181.23, 21.14),
|
|
])
|
|
def test_published_non_crossing_inputs_keep_their_arithmetic(mean, true, apogee, expected):
|
|
assert circular_chesta(mean, true, apogee) == expected
|