Files
Jyotisha/tests/test_double_transit_pac_aspect_count.py
T
Jesse_ChenandClaude Opus 5.5 42d1582f4c fix(transit): double-transit aspect check counts houses from 1 (upstream 2dd6062a)
Saturn's 7th aspect was judged on the 8th house, Jupiter 5/9 on 6/10, Mars
4/8 on 5/9. Ported from yinduzhanxing 2dd6062a with product authorization
(TASK-upstream-sync4-20261002 T2).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N4f2nya58RoRu4yEmJgRGE
2026-10-02 13:50:24 +08:00

31 lines
1.0 KiB
Python

"""BUG (sync4 T2): _check_pac counted the house distance from 0 but compared it
with 1-based aspect numbers, so Saturn's 7th aspect landed on the 8th house.
Ported from upstream yinduzhanxing 2dd6062a."""
from __future__ import annotations
import pytest
from scripts.jyotish_engine import _check_pac
def _lon(house: int) -> float:
return (house - 1) * 30 + 15.0
def _aspect_offsets(planet: str, target_house: int) -> list[int]:
rows = _check_pac(planet, _lon(1), _lon(target_house), 0)
return [row["offset"] for row in rows if row["type"] == "Aspect"]
@pytest.mark.parametrize("planet,hits", [
("Saturn", {3, 7, 10}), ("Jupiter", {5, 7, 9}), ("Mars", {4, 7, 8}), ("Venus", {7}),
])
def test_aspect_lands_on_the_numbered_house(planet: str, hits: set[int]) -> None:
for house in range(2, 13):
offsets = _aspect_offsets(planet, house)
if house in hits:
assert offsets == [house], (planet, house, offsets)
else:
assert offsets == [], (planet, house, offsets)