diff --git a/tests/test_badhaka_rules.py b/tests/test_badhaka_rules.py new file mode 100644 index 00000000..86a9369b --- /dev/null +++ b/tests/test_badhaka_rules.py @@ -0,0 +1,25 @@ +import sys +from pathlib import Path + + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / 'scripts')) + +from yoga_engine import YogaContext # noqa: E402 + + +def test_badhaka_houses_follow_chara_sthira_dual_rule_for_all_lagnas() -> None: + expected = { + 'Aries': 11, 'Cancer': 11, 'Libra': 11, 'Capricorn': 11, + 'Taurus': 9, 'Leo': 9, 'Scorpio': 9, 'Aquarius': 9, + 'Gemini': 7, 'Virgo': 7, 'Sagittarius': 7, 'Pisces': 7, + } + for ascendant, house in expected.items(): + context = YogaContext({}, ascendant) + assert context.is_badhaka(house) is True + assert context.is_badhaka(1 if house != 1 else 2) is False + + +def test_badhaka_rule_is_structural_and_does_not_emit_lifespan_claims() -> None: + source = (ROOT / 'scripts' / 'yoga_engine.py').read_text(encoding='utf-8') + assert '过早死亡风险' not in source