Files
Jyotisha/tests/test_open_source_integrations.py
T
jesse-uxGrok (agent loop)Cursor
cf063834ca feat(synastry): store the upstream seven-item marriage match
Move the bde5d615 engine and full-synastry skill in unchanged, save both profiles without billing or a page, and retire the old synastry module.

Checked targeted pytest, tsc 0, lint 0 errors, service tests 6/6, and test:db 73 pass / 13 fail matching the Windows known list.

Co-Authored-By: Grok (agent loop)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-18 16:44:05 +08:00

85 lines
2.7 KiB
Python

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
开源项目集成 smoke test
验证已从 MIT 开源项目适配进来的模块能在本 skill 中独立运行:
- dashaflow / jaimini-tropical: Jaimini Arudha A1-A12、Graha Pada、Special Lagnas
- jaimini-tropical: Argala + Virodhargala + Rajayoga classification
- dashaflow: Synastry additional kutas (Mahendra/StreeDeergha/Vedha/Rajju/BadConstellations)
"""
import json
import os
import sys
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SCRIPTS = os.path.join(ROOT, "scripts")
sys.path.insert(0, SCRIPTS)
from jaimini import calc_arudha_padas, calc_graha_padas, calc_special_lagnas
from argala import calc_argala
from ashtakoot import calculate_ashtakoot
def sample_planet_longitudes():
return {
"Sun": 3.5055,
"Moon": 311.7759,
"Mars": 91.3161,
"Mercury": 338.5287,
"Jupiter": 163.8233,
"Venus": 340.5447,
"Saturn": 304.2874,
"Rahu": 231.0339,
"Ketu": 51.0339,
}
def test_jaimini_arudha_modules():
asc_idx = 4 # Leo
lons = sample_planet_longitudes()
padas = calc_arudha_padas(asc_idx, lons)
assert padas["method"].startswith("Arudha Pada")
assert "A1" in padas["padas"]
assert "UL" in padas["padas"]
assert padas["padas"]["A10"]["name"] == "Karma Pada (A10)"
graha = calc_graha_padas(lons)
assert "Sun" in graha["graha_padas"]
assert "graha_pada_sign" in graha["graha_padas"]["Sun"]
special = calc_special_lagnas(asc_idx, 14, 45)
assert special["capability_status"] == "auxiliary_partial"
assert all(k in special for k in ("HL", "GL", "VL"))
def test_argala_enhanced_module():
asc_idx = 4
signs = {p: int(lon / 30) % 12 for p, lon in sample_planet_longitudes().items()}
result = calc_argala(signs, asc_idx)
assert result["version"] == "1.1"
assert "house_1" in result["houses"]
assert "rajayoga_classification" in result["houses"]["house_1"]
assert "summary" in result
def test_synastry_dashaflow_additional_kutas():
# 原值: synastry.calc_synastry,并断言 version == 3.8-dashaflow-mit-adapted
# 新值: ashtakoot.calculate_ashtakoot 的 additional_kutas
# 原因: scripts/synastry.py 退役;附加 Kuta 仍在 ashtakoot.py
result = calculate_ashtakoot(210.5, 45.2)
assert "additional_kutas" in result
for key in ("Mahendra", "StreeDeergha", "Vedha", "Rajju", "BadConstellations"):
assert key in result["additional_kutas"]
def main():
test_jaimini_arudha_modules()
test_argala_enhanced_module()
test_synastry_dashaflow_additional_kutas()
print(json.dumps({"status": "passed", "tests": 3}, ensure_ascii=False, indent=2))
if __name__ == "__main__":
main()