mirror of
https://github.com/migatu/astrololo.git
synced 2026-07-14 21:38:37 +00:00
a8c3072e62
Punkty wirtualne (LOG-02): - engine/points.py: mean Node (Ω) i mean Lilith (apogeum) wzorami Meeusa; prędkości numerycznie. SN = NN + 180° (ta sama prędkość), zawsze Rx. - DEFAULT_OBJECTS + North Node / South Node / Lilith — automatycznie dostają domy, aspekty i A/S. Parzystość silnika B: swe.MEAN_NODE / swe.MEAN_APOG (uwaga: stała pyswisseph to MEAN_APOG, nie MEAN_APOGEE). - significators: tokeny [NN / [SN / [Lilith (zgodne z SIGNIFICATORS KEY). Stacje (LOG-03): - engine/stations.py: skan prędkości (krok 4 dni, okno ±800 dni — pokrywa najdłuższe przerwy Marsa/Wenus) + bisekcja; klasyfikacja SD/SR; poprzednia/ następna stacja (dni, data, stopień w znaku) + flaga station_soon (<7 dni). - /chart/positions: opt-in stations:true; UI: checkbox + tabela stacji. Walidacja: - mean NN vs astro-seek (Gem 8°09'24"): Δ=0,3'; vs swisseph: Δ=17"; mean Lilith vs swisseph: Δ=1,5'. NN dom 12 / SN dom 6 zgodnie z astro-seek. - Stacje Marsa 1984 trafiają w historię: SR 5.04.1984, SD 19.06.1984; samospójność |speed|<0,01°/d w znalezionych momentach; flaga "blisko" działa (Merkury +5,3d, Jowisz -0,6d). - E2E na realnej bazie: [SN 134 rekordy, trafienie w 6. domu. 54 testy przechodzą. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
56 lines
2.2 KiB
Python
56 lines
2.2 KiB
Python
"""Testy wykrywania stacji (LOG-03).
|
|
|
|
Fakt historyczny: Mars w horoskopie referencyjnym (30.04.1984) jest w środku
|
|
retrogradacji — stacja SR ~5.04.1984 (ok. 25 dni wstecz), stacja SD ~19.06.1984
|
|
(ok. 50 dni w przód). Testy sprawdzają strukturę, klasyfikację SD/SR, przedziały
|
|
dat i samospójność (prędkość w znalezionym momencie ~0).
|
|
"""
|
|
import datetime as dt
|
|
|
|
import pytest
|
|
|
|
from app.engine.models import ChartMoment
|
|
from app.engine.stations import STATION_SOON_DAYS, find_stations
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def mars_stations(own_engine, reference_moment):
|
|
return find_stations(own_engine, reference_moment, "Mars")
|
|
|
|
|
|
def test_no_stations_for_sun_moon_and_points(own_engine, reference_moment):
|
|
for name in ("Sun", "Moon", "North Node", "South Node", "Lilith"):
|
|
assert find_stations(own_engine, reference_moment, name) is None
|
|
|
|
|
|
def test_mars_prev_is_sr_next_is_sd(mars_stations):
|
|
assert mars_stations["prev"]["type"] == "SR" # wszedł w retrogradację
|
|
assert mars_stations["next"]["type"] == "SD" # wróci do ruchu prostego
|
|
|
|
|
|
def test_mars_station_windows_match_history(mars_stations):
|
|
# SR ~5.04.1984 -> ok. -25 dni; SD ~19/20.06.1984 -> ok. +50 dni
|
|
assert -35 < mars_stations["prev"]["days"] < -15
|
|
assert 40 < mars_stations["next"]["days"] < 60
|
|
assert mars_stations["prev"]["date"].startswith("1984-04")
|
|
assert mars_stations["next"]["date"].startswith("1984-06")
|
|
|
|
|
|
def test_station_speed_is_near_zero(own_engine, reference_moment, mars_stations):
|
|
"""Samospójność: w znalezionym momencie stacji prędkość Marsa ~0."""
|
|
for key in ("prev", "next"):
|
|
when = dt.datetime.strptime(mars_stations[key]["date"], "%Y-%m-%d %H:%M").replace(
|
|
tzinfo=dt.timezone.utc
|
|
)
|
|
m = ChartMoment(when_utc=when, lat=reference_moment.lat, lon=reference_moment.lon)
|
|
speed = own_engine.positions(m, ["Mars"])[0].speed
|
|
assert abs(speed) < 0.01, f"{key}: speed={speed}"
|
|
|
|
|
|
def test_station_soon_flag_consistent(mars_stations):
|
|
expected = any(
|
|
abs(mars_stations[k]["days"]) < STATION_SOON_DAYS
|
|
for k in ("prev", "next") if k in mars_stations
|
|
)
|
|
assert mars_stations["station_soon"] == expected
|