fix: 달이 안 보일 때 이유를 붙여 말하기(삭·일찍 짐·늦게 뜸·흐림), 달 포스트 설명글을 본문 판정에 맞추기

This commit is contained in:
minaChoi committed 2026-10-12 09:26:50 +09:00
1 parent ef57a47e29
commit f4fe3e965c
6 files changed
+25 -13

No files matched your search

+7 -3
View File
@@ -1,9 +1,10 @@
from dataclasses import replace
from datetime import datetime, timedelta, timezone
from types import SimpleNamespace
from common.enums import PostType
from common.utils.kma_time import KST
from services.calc.moon import altitude, nearest, night, phase_name, view_line
from services.calc.moon import MoonNight, altitude, nearest, night, phase_name, view_line
from services.feed_service import FeedService, _tonight
@@ -57,7 +58,7 @@ def test_full_moon_is_up_all_night_and_highest_near_solar_midnight():
peak = max((start + timedelta(hours=22, minutes=10 * i) for i in range(24)), key=lambda t: altitude(t, *SEOUL))
assert 23 <= (peak.hour if peak.hour >= 12 else peak.hour + 24) <= 25
assert view_line(m, 0.0) == "밤새 잘 보여요"
assert view_line(m, 0.8) == "구름에 가려요"
assert view_line(m, 0.8) == "흐려서 구름에 가려요"
def test_first_quarter_sets_around_midnight_and_new_moon_is_not_seen():
@@ -65,7 +66,10 @@ def test_first_quarter_sets_around_midnight_and_new_moon_is_not_seen():
quarter = night(_night_of(new + timedelta(days=7.4)), *SEOUL)
assert quarter.set_at is not None and quarter.set_at.astimezone(KST).hour in (21, 22, 23, 0, 1, 2)
assert view_line(quarter, 0.0).endswith("까지 보여요")
assert view_line(night(_night_of(new), *SEOUL), 0.0) == "달이 안 보여요"
assert view_line(night(_night_of(new), *SEOUL), 0.0) == "해와 같은 쪽에 있어 안 보여요"
hidden = MoonNight(name="초승달", lit=0.05, waxing=True, rise_at=None, set_at=None, up_hours=())
assert view_line(hidden, 0.0) == "해 진 뒤 곧 져서 밤엔 안 보여요"
assert view_line(replace(hidden, name="그믐달", waxing=False), 0.0) == "새벽 늦게 떠서 밤엔 안 보여요"
def test_waning_moon_rises_late():