Files
Jyotisha/tests/test_dwisaptatisama_dasha.py
T
Jesse_ChenandCursor 04ad3325d5
Independent Staging Quality Gate / validate (push) Successful in 11m26s
Independent Staging Quality Gate / publish (push) Successful in 13m24s
fix(relationship): freeze marriage event classes and add conditional dashas (BUG-608)
Venus/Jupiter/Moon periods no longer collapse into one marriage-opportunity line. Full reading reports the ten BPHS conditional dasha families; Skill 6.9.16.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-09 16:04:52 +08:00

78 lines
2.7 KiB
Python

"""Source-bounded regression tests for Dwisaptatisama MD."""
from __future__ import annotations
import json
from datetime import datetime
from pathlib import Path
from scripts.dwisaptatisama_dasha import (
calculate_dwisaptatisama_dasha,
dwisaptatisama_applicability,
)
ROOT = Path(__file__).resolve().parents[1]
def test_dwisaptatisama_accepts_lagna_lord_in_lagna_or_seventh() -> None:
first = dwisaptatisama_applicability(ascendant_longitude=0.0, lagna_lord_sign_index=0)
seventh = dwisaptatisama_applicability(ascendant_longitude=0.0, lagna_lord_sign_index=6)
assert first["applicable"] is True
assert first["lagna_lord_house"] == 1
assert seventh["applicable"] is True
assert seventh["lagna_lord_house"] == 7
def test_dwisaptatisama_rejects_other_lagna_lord_houses() -> None:
result = dwisaptatisama_applicability(ascendant_longitude=0.0, lagna_lord_sign_index=1)
assert result["applicable"] is False
assert result["lagna_lord_house"] == 2
def test_dwisaptatisama_blocks_without_explicit_lagna_lord_position() -> None:
result = calculate_dwisaptatisama_dasha({
"birth_datetime": "2000-01-01T00:00:00",
"ascendant_longitude": 0.0,
"moon_longitude": 250.0,
})
assert result["execution_status"] == "blocked"
assert "lagna_lord_sign_index" in result["reason"]
def test_dwisaptatisama_emits_only_source_bounded_md() -> None:
result = calculate_dwisaptatisama_dasha({
"birth_datetime": datetime(2000, 1, 1, 12, 0),
"ascendant_longitude": 0.0,
"lagna_lord_sign_index": 0,
"moon_longitude": 250.0,
})
assert result["execution_status"] == "executed"
assert result["confidence_status"] == "parameter_sensitive"
assert result["total_cycle"] == 72
assert result["starting_lord"] == "Sun" # Mula is the seed.
assert result["major"][0]["start_date"] == "2000-01-01T12:00:00"
assert result["major"][0]["years"] < 9.0
assert result["period_depth_status"] == "mahadasha_executed_ad_pd_blocked_pending_row_level_replay"
assert "antardasha" not in result["major"][0]
def test_dwisaptatisama_standard_table_profile_preserves_unmet_gate_but_emits_rows() -> None:
result = calculate_dwisaptatisama_dasha({
"birth_datetime": "2000-01-01T12:00:00",
"ascendant_longitude": 0.0,
"lagna_lord_sign_index": 1,
"moon_longitude": 250.0,
"standard_table_profile": "pl9_reports_all_dasha_tables_v1",
})
assert result["execution_status"] == "executed"
assert result["classical_applicable"] is False
assert result["standard_table_profile"] == "pl9_reports_all_dasha_tables_v1"
assert len(result["major"]) == 8