"""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)