61 lines
1.7 KiB
Python
61 lines
1.7 KiB
Python
#!/usr/bin/env python3
|
|
"""CLI smoke tests for critical Jyotish engine commands."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import subprocess
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
ENGINE = ROOT / "scripts" / "jyotish_engine.py"
|
|
BASE_BIRTH_ARGS = [
|
|
"--year", "1990",
|
|
"--month", "1",
|
|
"--day", "1",
|
|
"--hour", "12",
|
|
"--minute", "0",
|
|
"--lat", "39.9",
|
|
"--lon", "116.4",
|
|
"--tz", "8",
|
|
]
|
|
|
|
|
|
def run_engine(*args: str) -> dict:
|
|
completed = subprocess.run(
|
|
[sys.executable, str(ENGINE), *args],
|
|
cwd=ROOT,
|
|
check=True,
|
|
capture_output=True,
|
|
text=True,
|
|
)
|
|
return json.loads(completed.stdout)
|
|
|
|
|
|
def test_dasha_accepts_birth_datetime_without_explicit_nakshatra() -> None:
|
|
result = run_engine("dasha", *BASE_BIRTH_ARGS, "--today", "2026-01-01")
|
|
assert "moon_nakshatra" in result
|
|
assert len(result.get("timeline", [])) == 9
|
|
assert result["timeline"][0]["is_balance"] is True
|
|
|
|
|
|
def test_varga_cli_outputs_d9_and_d10() -> None:
|
|
result = run_engine("varga", *BASE_BIRTH_ARGS, "--d9", "--d10")
|
|
charts = result.get("divisional_charts", {})
|
|
assert "D9_Navamsa" in charts
|
|
assert "D10_Dasamsa" in charts
|
|
assert "Moon" in charts["D9_Navamsa"]
|
|
|
|
|
|
def test_ashtakavarga_cli_keeps_sav_invariant() -> None:
|
|
result = run_engine("ashtakavarga", *BASE_BIRTH_ARGS)
|
|
assert result["sav"]["total"] == 337
|
|
assert result["sav"]["valid"] is True
|
|
assert result["all_bav_valid"] is True
|
|
|
|
|
|
def test_audit_capabilities_cli_validates_registry() -> None:
|
|
result = run_engine("audit-capabilities", "--mode", "validate")
|
|
assert result.get("valid") is True
|