fix: 주말 동선 행사를 축제→공연→팝업→전시 순으로 종류마다 하나씩
This commit is contained in:
1 parent
73294622ad
commit
f4d5472776
2 files changed
+22
-5
No files matched your search
@@ -1,6 +1,7 @@
|
||||
from datetime import date, datetime
|
||||
from types import SimpleNamespace
|
||||
|
||||
from common.enums import EventKind
|
||||
from common.utils.kma_time import KST
|
||||
from services.week_service import DayPlan, EventItem
|
||||
from services.weekend_plan import day_plan, forecast, pick_events
|
||||
@@ -14,8 +15,8 @@ def _day(d: date, lo=12.0, hi=26.0, rainy=False, rain_hours=None, prob=10) -> Da
|
||||
headline="", summary="", pick="", rain_hours=rain_hours, is_rainy=rainy, rain_prob=prob)
|
||||
|
||||
|
||||
def _event(name, start, end, dist, image="https://img/x.jpg") -> EventItem:
|
||||
e = SimpleNamespace(event_id=hash(name), name=name, icon="fireworks", start_date=start, end_date=end, place_name="경기도 고양시 일산동구 호수로 595", image_url=image, source_id="1")
|
||||
def _event(name, start, end, dist, image="https://img/x.jpg", kind=EventKind.FESTIVAL) -> EventItem:
|
||||
e = SimpleNamespace(event_id=hash(name), name=name, kind=kind, icon="fireworks", start_date=start, end_date=end, place_name="경기도 고양시 일산동구 호수로 595", image_url=image, source_id="1")
|
||||
return EventItem(event=e, status="live", status_label="진행 중", fit=None, distance_km=dist)
|
||||
|
||||
|
||||
@@ -64,6 +65,14 @@ def test_saturday_ignores_ending_hook_and_sunday_skips_saturday_events():
|
||||
assert pick_events(SUN, [near, far], frozenset(e.event.event_id for e in sat)) == []
|
||||
|
||||
|
||||
def test_festival_and_concert_come_before_nearer_galleries():
|
||||
events = [_event("옆 전시1", SAT, SUN, 0.5, kind=EventKind.EXHIBITION), _event("옆 전시2", SAT, SUN, 0.6, kind=EventKind.EXHIBITION),
|
||||
_event("먼 공연", SAT, SAT, 20.0, kind=EventKind.CONCERT), _event("먼 축제", SAT, SUN, 25.0)]
|
||||
assert [e.event.name for e in pick_events(SAT, events)] == ["먼 축제", "먼 공연"]
|
||||
only_galleries = events[:2]
|
||||
assert [e.event.name for e in pick_events(SAT, only_galleries)] == ["옆 전시1", "옆 전시2"]
|
||||
|
||||
|
||||
def test_cloudy_weekend_is_not_called_clear():
|
||||
cloudy = [_day(SAT), _day(SUN)]
|
||||
for d in cloudy:
|
||||
|
||||
Reference in new issue
Block a user