Files
Jyotisha/tests/test_yoga_saraswathi_source.py
ClaudeandClaude Opus 5.5 ab018c4ea3
Independent Staging Quality Gate / validate-python (push) Successful in 8m51s
Independent Staging Quality Gate / validate-frontend (push) Successful in 13m20s
Independent Staging Quality Gate / publish (push) Successful in 3m20s
fix(yoga): missing input is never formed, Moolatrikona uses degree intervals, Parijatha/Gaja/Saraswathi follow the astrologer's upstream definitions (BUG-2222)
Port from yinduzhanxing b6754475 (astrologer's 2026-11-22 port order):
- MissingYogaInput: failure rows carry incomplete_conditions + missing_inputs;
  incomplete matches move effects to traditional_effects(+_en); AND merges
  condition_status/missing_inputs/condition_checks; NOT never turns an
  incomplete candidate into truth.
- MOOLATRIKONA_DEGREES + degree-interval is_moolatrikona; moolatrikona_degree
  contract check; Saraswathi PVR p143 contract.
- New evaluators: Raman Parijatha (47), Gaja (48, with parashari_aspect),
  Saraswathi PVR, all_planets_in_sign_type (Rajju/Musala/Nala, seven planets).
- meaning_source_reference copied onto result rows. Not-implemented 71 -> 65.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbBXp2U3BH1SxwAGyhhbe1
2026-11-22 21:42:41 +08:00

55 lines
2.1 KiB
Python

"""BUG-2222 (upstream yinduzhanxing b6754475): Saraswathi per PVR p.143 — positive, counterexample and missing input."""
from __future__ import annotations
import sys
from pathlib import Path
import pytest
ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(ROOT / "scripts"))
from yoga_engine import SIGNS, YogaEngine # noqa: E402
@pytest.fixture(params=["saraswati_yoga", "bvr_saraswathi_yoga"])
def engine(request):
e = YogaEngine(str(ROOT / "references" / "yoga_rules.json"))
e.rules = [r for r in e.rules if r["id"] == request.param]
assert len(e.rules) == 1
return e
def run(engine, placements):
rid = engine.rules[0]["id"]
rows = engine.detect({p: {"sign": SIGNS[h - 1], "house": h} for p, h in placements.items()},
"Aries", context={"chart_type": "D1"})
return [r for r in rows if r["rule_id"] == rid]
@pytest.mark.parametrize("house", [1, 2, 4, 5, 7, 9, 10])
def test_each_allowed_house_includes_first_and_fifth(engine, house):
row, = run(engine, {"Jupiter": 9, "Mercury": house, "Venus": 2})
assert row["condition_status"] == "conditions_met"
assert row["formation_assessment"]["status"] == "formed_under_source"
assert not row["formation_assessment"]["outcome_admitted"]
assert set(row["planets"]) == {"Mercury", "Jupiter", "Venus"}
@pytest.mark.parametrize("planet", ["Mercury", "Venus", "Jupiter"])
def test_all_three_required_not_two_of_three(engine, planet):
assert not run(engine, {**{"Jupiter": 9, "Mercury": 1, "Venus": 2}, planet: 6})
def test_missing_planet_stays_incomplete(engine):
row, = run(engine, {"Jupiter": 9, "Mercury": 1})
assert row["condition_status"] == "incomplete_conditions"
assert "Venus.house" in row["missing_inputs"]
assert not row["effects"]
assert row["formation_assessment"]["status"] == "candidate"
@pytest.mark.parametrize("house,formed", [(1, True), (4, True), (5, True), (9, True), (2, False), (7, False), (10, False)])
def test_jupiter_dignity_natural_friends_not_generic_good_house(engine, house, formed):
assert bool(run(engine, {"Jupiter": house, "Mercury": 1, "Venus": 2})) is formed