"""Source-bounded regression tests for Niryaana Shoola MD.""" from __future__ import annotations import json from datetime import datetime from pathlib import Path from scripts.niryaana_shoola_dasha import ( calculate_niryaana_shoola_dasha, niryaana_shoola_applicability, ) ROOT = Path(__file__).resolve().parents[1] def test_niryaana_shoola_selects_stronger_lagna_or_seventh() -> None: lagna = niryaana_shoola_applicability( ascendant_longitude=0.0, lagna_strength=2.0, seventh_strength=1.0 ) seventh = niryaana_shoola_applicability( ascendant_longitude=0.0, lagna_strength=1.0, seventh_strength=2.0 ) assert lagna["starting_sign"] == "Aries" assert seventh["starting_sign"] == "Libra" def test_niryaana_shoola_blocks_strength_ties() -> None: result = niryaana_shoola_applicability( ascendant_longitude=0.0, lagna_strength=1.0, seventh_strength=1.0 ) assert result["execution_status"] == "blocked" assert "tie-break profile is not closed" in result["reason"] def test_niryaana_shoola_emits_forward_nine_year_md_rows() -> None: result = calculate_niryaana_shoola_dasha({ "birth_datetime": datetime(2000, 1, 1, 12, 0), "ascendant_longitude": 0.0, "lagna_strength": 2.0, "seventh_strength": 1.0, }) assert result["execution_status"] == "executed" assert result["confidence_status"] == "parameter_sensitive" assert result["total_cycle"] == 108 assert len(result["major"]) == 12 assert [row["sign"] for row in result["major"][:3]] == ["Aries", "Taurus", "Gemini"] assert all(row["years"] == 9 for row in result["major"]) assert result["period_depth_status"] == "mahadasha_executed_ad_pd_blocked_pending_row_level_replay"