8db716ca36
The homepage was waiting on a full chart plus four extra engines, so the card timed out and showed the failure copy on every visit. Co-authored-by: Cursor <cursoragent@cursor.com>
66 lines
2.2 KiB
Python
66 lines
2.2 KiB
Python
from __future__ import annotations
|
|
|
|
from scripts.daily_guidance_service import build_daily_guidance
|
|
|
|
|
|
PLANETS = {"Sun", "Moon", "Mars", "Mercury", "Jupiter", "Venus", "Saturn", "Rahu", "Ketu"}
|
|
SIGNS = {
|
|
"Aries", "Taurus", "Gemini", "Cancer", "Leo", "Virgo",
|
|
"Libra", "Scorpio", "Sagittarius", "Capricorn", "Aquarius", "Pisces",
|
|
}
|
|
|
|
|
|
def test_daily_guidance_returns_short_positive_evidence_packet() -> None:
|
|
packet = build_daily_guidance({
|
|
"year": 1990,
|
|
"month": 1,
|
|
"day": 1,
|
|
"hour": 12,
|
|
"minute": 0,
|
|
"lat": 39.9,
|
|
"lon": 116.4,
|
|
"tz": 8,
|
|
"date": "2026-07-17",
|
|
"ayanamsa": "lahiri",
|
|
"node_mode": "mean",
|
|
})
|
|
|
|
assert packet["success"] is True
|
|
assert packet["endpoint"] == "daily_guidance"
|
|
assert packet["word_count"] <= 100
|
|
assert packet["daily_star_words"].startswith("今日星语:")
|
|
assert packet["audit"]["not_a_prediction"] is True
|
|
assert {"D1", "Daily Transit"} <= {row["layer"] for row in packet["evidence"]}
|
|
assert packet["suggested_actions"]
|
|
assert packet["moon_house"] in range(1, 13)
|
|
assert packet["moon_sign"] in SIGNS
|
|
assert packet["ascendant_sign"] in SIGNS
|
|
assert packet["mahadasha_lord"] in PLANETS
|
|
assert packet["theme"]
|
|
vimshottari = next(row for row in packet["evidence"] if row["layer"] == "Vimshottari")
|
|
assert vimshottari["status"] == "used"
|
|
|
|
|
|
def test_daily_guidance_changes_with_the_calendar_day() -> None:
|
|
body = {
|
|
"year": 1990,
|
|
"month": 1,
|
|
"day": 1,
|
|
"hour": 12,
|
|
"minute": 0,
|
|
"lat": 39.9,
|
|
"lon": 116.4,
|
|
"tz": 8,
|
|
"ayanamsa": "lahiri",
|
|
"node_mode": "mean",
|
|
}
|
|
first = build_daily_guidance({**body, "date": "2026-07-17"})
|
|
later = build_daily_guidance({**body, "date": "2026-08-19"})
|
|
assert first["moon_sign"] != later["moon_sign"] or first["moon_house"] != later["moon_house"]
|
|
|
|
|
|
def test_daily_guidance_endpoint_is_registered() -> None:
|
|
source = __import__("pathlib").Path("scripts/jyotish_api_server.py").read_text(encoding="utf-8")
|
|
assert "/api/daily_guidance" in source
|
|
assert "daily_guidance_service" in source
|