feat: 우산분실각(비 그친 뒤 우산 두고 오기 쉬운 정도)·교통체증각(출퇴근길 비·눈·추위) 추가, '앞서 비 옴' 조건(rain_before)

This commit is contained in:
minaChoi committed 2026-10-14 09:08:50 +09:00
1 parent b586db0de7
commit 0aeceac257
5 files changed
+186 -3

No files matched your search

+10
View File
@@ -308,3 +308,13 @@ def test_humidity_cap():
def test_axis_label_can_be_overridden():
assert axis_label("temp", {"temp": {"type": "higher", "label": "덜 추움"}}) == "덜 추움"
def test_umbrella_lost_needs_rain_that_stopped():
"""우산분실각: 앞서 비가 왔다가 그친 시간대만 점수가 난다. 비가 안 온 날, 아직 비가 오는 시간대는 0점."""
defn = _defn(weight_temp=0, weight_rain=80, weight_wind=0, weight_humidity=0, weight_air=0, weight_time=20,
zero_rules=[{"field": "rain_before", "op": "==", "value": "no"}, {"field": "rain", "op": "==", "value": "yes"}])
after_rain = replace(CTX, rain_hours=frozenset({9, 10}))
assert evaluate(defn, [[_h(13), _h(14)]], after_rain).score >= 80
assert evaluate(defn, [[_h(13), _h(14)]], CTX).zero_reason == "앞서 내린 비가 없어 0점"
assert evaluate(defn, [[_h(10, rain=RainType.RAIN)]], replace(CTX, rain_hours=frozenset({9, 10}))).score == 0