Files
astrololo/services/logic/tests/test_firdaria.py
T
gitea 9d5b65ddbd Firdaria (LOG-11) — perska technika time-lord
- engine/firdaria.py: sekta (dzień = Słońce nad horyzontem, ta sama półkula
  osi Asc-Dsc co MC); kolejność diurnalna/nokturnalna; klasyczne długości
  okresów (Su10 Ve8 Me13 Mo9 Sa11 Ju12 Ma7 + NN3 + SN2 = 75 lat); okresy główne
  planet dzielone na 7 podokresów (sub-lord od władcy okresu), węzły bez sub.
- endpoint /chart/firdaria.
- oś czasu: firdaria_events — starty (pod)okresów w oknie; wpięte w build_timeline
  (domyślnie) + tokeny [major][sub] do dopięcia interpretacji (1B->2B).

Walidacja:
- sekta = day dla horoskopu referencyjnego (zgodnie z notes3 "Day birth");
  night gdy Słońce po stronie IC; sumy i przyleganie okresów; podokresy 7x
  sumujące się do okresu; wiek 42 w okresie Saturna.
- E2E: okresy Sun 1984-1994 ... Saturn 2024-2035; w osi czasu
  "Firdaria: Saturn / Mars" 2027 -> 223 interpretacje ([Sa+[Ma -> "injury").
- 78 testów przechodzi (nowy test_firdaria).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-17 22:48:53 +02:00

59 lines
2.2 KiB
Python

"""Firdaria (LOG-11) — sekta, kolejność, długości okresów, podokresy."""
import datetime as dt
from app.engine.firdaria import DAY_ORDER, NIGHT_ORDER, YEARS, firdaria, is_day_birth
from app.significators import _event_tokens
BIRTH = dt.datetime(1984, 4, 30, 7, 35, tzinfo=dt.timezone.utc)
# horoskop referencyjny: Asc 112.18, MC 352.59, Sun 40.14 -> Day birth (notes3)
ASC, MC, SUN = 112.18, 352.59, 40.14
def test_reference_is_day_birth():
assert is_day_birth(SUN, ASC, MC) is True # notes3: "Day birth (Diurnal)"
def test_night_birth_uses_night_order():
# Słońce po stronie IC (przeciwna półkula) -> noc
assert is_day_birth((SUN + 180) % 360, ASC, MC) is False
fd = firdaria(BIRTH, (SUN + 180) % 360, ASC, MC)
assert fd["sect"] == "night" and fd["order"] == NIGHT_ORDER
def test_diurnal_sequence_and_totals():
fd = firdaria(BIRTH, SUN, ASC, MC)
assert fd["sect"] == "day" and fd["order"] == DAY_ORDER
lords = [p["lord"] for p in fd["periods"]]
assert lords == DAY_ORDER + ["North Node", "South Node"]
assert sum(p["years"] for p in fd["periods"]) == 75 # 70 + 3 + 2
def test_planet_majors_have_seven_subperiods_summing_to_period():
fd = firdaria(BIRTH, SUN, ASC, MC)
for p in fd["periods"]:
if p["lord"] in YEARS:
assert len(p["sub"]) == 7
assert p["sub"][0]["lord"] == p["lord"] # sub zaczyna się od władcy okresu
assert p["sub"][0]["start"] == p["start"]
assert p["sub"][-1]["end"] == p["end"]
else:
assert "sub" not in p # węzły bez podokresów
def test_periods_are_contiguous():
fd = firdaria(BIRTH, SUN, ASC, MC)
for a, b in zip(fd["periods"], fd["periods"][1:]):
assert a["end"] == b["start"]
def test_age_42_is_saturn_major():
# kumulatywnie: Su10 Ve8 Me13 Mo9 -> 40; Saturn 40-51 -> wiek 42 w Saturnie
fd = firdaria(BIRTH, SUN, ASC, MC)
saturn = next(p for p in fd["periods"] if p["lord"] == "Saturn")
assert saturn["start"].startswith("2024") and saturn["end"].startswith("2035")
def test_event_tokens_firdaria():
ev = {"technique": "firdaria", "fd_major": "Saturn", "fd_sub": "Jupiter"}
assert _event_tokens(ev) == ["[Sa", "[Ju"]