Files
Jyotisha/tests/test_panchottari_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

94 lines
3.5 KiB
Python

"""Source-bounded regression tests for the local Panchottari producer."""
from __future__ import annotations
import json
from datetime import datetime
from pathlib import Path
from scripts.panchottari_dasha import calculate_panchottari_dasha, panchottari_applicability
from scripts.source_bounded_child_periods import PYJHORA_PARENT_SEEDED_EQUAL_SPLIT_PROFILE
ROOT = Path(__file__).resolve().parents[1]
def test_panchottari_requires_cancer_in_rasi_and_d12() -> None:
result = panchottari_applicability(ascendant_longitude=90.0)
assert result["applicable"] is True
assert result["ascendant_rasi_sign_index"] == 3
assert result["ascendant_d12_sign_index"] == 3
def test_panchottari_rejects_cancer_rasi_when_d12_is_not_cancer() -> None:
result = panchottari_applicability(ascendant_longitude=93.0)
assert result["applicable"] is False
assert result["ascendant_rasi_sign_index"] == 3
assert result["ascendant_d12_sign_index"] == 4
def test_panchottari_builds_birth_balance_without_inventing_ad_pd_boundaries() -> None:
result = calculate_panchottari_dasha({
"birth_datetime": datetime(2000, 1, 1, 12, 0),
"ascendant_longitude": 90.0,
"moon_longitude": 220.0,
"dasha_year_days": 365.25636,
})
assert result["execution_status"] == "executed"
assert result["confidence_status"] == "parameter_sensitive"
assert result["starting_lord"] == "Sun" # Anuradha is the Panchottari seed.
assert result["total_cycle"] == 105
assert result["major"][0]["planet"] == "Sun"
assert result["major"][0]["start_date"] == "2000-01-01T12:00:00"
assert result["major"][0]["years"] < 12.0
assert result["period_depth_status"] == "mahadasha_executed_ad_pd_blocked_pending_row_level_replay"
assert "antardasha" not in result["major"][0]
def test_panchottari_keeps_non_applicable_result_non_executed() -> None:
result = calculate_panchottari_dasha({
"birth_datetime": "2000-01-01T12:00:00",
"ascendant_longitude": 93.0,
"moon_longitude": 220.0,
})
assert result["execution_status"] == "not_applicable"
assert result["major"] == []
def test_panchottari_standard_table_profile_preserves_unmet_gate_but_emits_rows() -> None:
result = calculate_panchottari_dasha({
"birth_datetime": "2000-01-01T12:00:00",
"ascendant_longitude": 93.0,
"moon_longitude": 220.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"]) == 7
def test_panchottari_can_emit_pyjhora_observed_child_profile_when_explicit() -> None:
result = calculate_panchottari_dasha({
"birth_datetime": datetime(2000, 1, 1, 12, 0),
"ascendant_longitude": 90.0,
"moon_longitude": 220.0,
"child_period_profile": PYJHORA_PARENT_SEEDED_EQUAL_SPLIT_PROFILE,
})
first_md = result["major"][0]
first_ad = first_md["antardasha"][0]
first_pd = first_ad["pratyantardasha"][0]
assert result["period_depth_status"] == "mahadasha_antardasha_pratyantardasha_executed_pyjhora_observed_profile"
assert len(result["antardasha"]) == 49
assert len(result["pratyantardasha"]) == 343
assert first_ad["lord"] == first_md["lord"]
assert first_pd["lord"] == first_ad["lord"]
assert first_md["antardasha"][-1]["end_date"] == first_md["end_date"]