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