Files
Jyotisha/tests/test_shadbala_hora_civil_weekday.py
T
Jesse_ChenandClaude Opus 5.5 08376cf0a8 fix(shadbala): Ayana hemisphere after wrap, civil-weekday hora lord, continuous mean motion, short-arc Chesta midpoint (upstream 0afa2780)
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
2026-10-02 13:55:58 +08:00

31 lines
1.2 KiB
Python

from datetime import date, timedelta
import swisseph as swe
import pytest
from scripts.shadbala import _calendar_lords
def context(day, hour):
return {"year": day.year, "month": day.month, "day": day.day,
"jd_local": swe.julday(day.year, day.month, day.day, hour),
"local_hour": hour, "sunrise_hour": 6.0}
@pytest.mark.parametrize("offset,lord", enumerate(
("Sun", "Moon", "Mars", "Mercury", "Jupiter", "Venus", "Saturn")))
def test_first_hora_is_weekday_lord(offset, lord):
assert _calendar_lords(context(date(2026, 9, 27) + timedelta(days=offset), 6.1))["hora"] == lord
def test_no_artificial_weekday_switch_at_julian_noon():
# Saturday: seventh hour is Moon, eighth Saturn, ninth Jupiter.
day = date(1993, 4, 17)
assert _calendar_lords(context(day, 12.0))["hora"] == "Moon"
assert _calendar_lords(context(day, 12.01))["hora"] == "Moon"
assert _calendar_lords(context(day, 13.01))["hora"] == "Saturn"
assert _calendar_lords(context(day, 14.01))["hora"] == "Jupiter"
def test_before_sunrise_uses_previous_weekday():
# Sunday 05:30 remains Saturday's 24th hora (Mars).
assert _calendar_lords(context(date(2026, 9, 27), 5.5))["hora"] == "Mars"