Merge branch 'main' into feat/open-meteo

# Conflicts:
#	backend/router/v1/index/index.py
#	backend/services/calc/index_calc.py
#	backend/services/index_service.py
#	backend/tests/conftest.py
#	backend/tests/test_index_api.py
#	backend/tests/test_index_calc.py
#	backend/tests/test_sky_api.py
#	backend/worker_main.py
This commit is contained in:
skkim committed 2026-10-07 10:07:54 +09:00
commit 1a1df4bb87
111 files changed
+5787 -679

No files matched your search

+24 -2
View File
@@ -1,8 +1,9 @@
from datetime import datetime, timezone
from datetime import date, datetime, timedelta, timezone
from common.enums import Confidence, SkyGrade, SkyType
from common.utils.geo import destination, haversine_km
from services.calc.sky_score import Layers, best_times, confidence, grade, score
from services.calc.sky_score import GRADE_LABEL, Layers, best_times, confidence, grade, reason, score, sunset_timeline, verdict
from services.calc.sun import sun_times
CLEAR = Layers(0, 0, 0)
@@ -43,3 +44,24 @@ def test_sunset_best_times_order():
dusk = datetime(2026, 10, 2, 9, 41, tzinfo=timezone.utc)
labels = [t["label"] for t in best_times(SkyType.SUNSET, sunset, dusk, 50)]
assert labels == ["해 져요", "가장 붉을 때", "보랏빛 하늘"]
def test_reason_names_what_decided_the_score():
canvas = Layers(low=0, mid=20, high=50)
assert "알맞게" in reason(canvas, CLEAR)
assert "먼 하늘" in reason(canvas, Layers(low=90, mid=50, high=0))
assert "낮은 구름" in reason(Layers(100, 0, 0), CLEAR)
assert "거의 없어" in reason(CLEAR, CLEAR)
def test_verdict_bands_and_gray_label_is_not_weather_word():
assert [verdict(v) for v in (60, 59, 40, 39)] == ["go", "maybe", "maybe", "rest"]
assert GRADE_LABEL[SkyGrade.GRAY] != "흐림"
def test_sunset_timeline_runs_golden_to_blue():
sun = sun_times(date(2026, 10, 6), 37.56, 126.91)
rows = sunset_timeline(sun.golden_start_at, sun.sunset_at, sun.sunset_at + timedelta(minutes=15), sun.dusk_end_at)
assert [r["kind"] for r in rows] == ["golden", "sun", "peak", "blue"]
ats = [datetime.fromisoformat(r["at"]) for r in rows]
assert ats == sorted(ats) and 15 <= (ats[1] - ats[0]).total_seconds() / 60 <= 60