chore: main 병합 — 지금 날씨 점수 보정을 바꾸기 표로 통일
- index_service.py 충돌: main 의 오늘·내일 날씨 점수 계산은 그대로 쓰고, 보정만 strict_weather 에서 구간별 바꾸기 표(weather_slot_scores)로 바꿈
- weather_slot_scores 는 main 의 weather_why 가 쓰는 점수 근거(factors)를 그대로 둔 Result 를 돌려줌
- strict_weather 와 그 테스트(test_weather_score_is_strict_near_top) 삭제 (바꾸기 표로 통일하기로 정함)
- test_board_activates_gak_outside_its_time_window 의 ensure 스텁을 main 의 {날짜: {구간: Result}} 모양으로 맞춤
This commit is contained in:
commit
621a0cf90d
133 files changed
+8963
-489
No files matched your search
@@ -1,5 +1,5 @@
|
||||
from dataclasses import replace
|
||||
from datetime import date
|
||||
from types import SimpleNamespace
|
||||
|
||||
from services.calc.index_calc import Context, evaluate
|
||||
from services.index_service import EARLY, WEATHER_SCORE_DEF, WEATHER_SCORE_TABLE, calibrated_weather, weather_slot_scores
|
||||
@@ -48,6 +48,10 @@ def test_calibrated_uses_slot_table_and_last_night_for_early():
|
||||
assert calibrated_weather(EARLY, 70) == WEATHER_SCORE_TABLE["night"][70]
|
||||
|
||||
|
||||
def test_weather_slot_scores_shows_calibrated_values():
|
||||
results = {k: SimpleNamespace(score=s) for k, s in {"morning": 40, "night": 60, EARLY: 60}.items()}
|
||||
assert weather_slot_scores(results) == {"morning": WEATHER_SCORE_TABLE["morning"][40], "night": WEATHER_SCORE_TABLE["night"][60], EARLY: WEATHER_SCORE_TABLE["night"][60]}
|
||||
def test_weather_slot_scores_keeps_results_with_calibrated_scores():
|
||||
"""점수 근거(factors)는 그대로 두고 점수만 표시 점수로 바꾼 결과를 돌려준다."""
|
||||
results = {k: replace(evaluate(WEATHER_SCORE_DEF, [[_h(12)]], PERFECT), score=s) for k, s in {"morning": 40, "night": 60, EARLY: 60}.items()}
|
||||
shown = weather_slot_scores(results)
|
||||
assert {k: r.score for k, r in shown.items()} == {"morning": WEATHER_SCORE_TABLE["morning"][40], "night": WEATHER_SCORE_TABLE["night"][60], EARLY: WEATHER_SCORE_TABLE["night"][60]}
|
||||
assert all(shown[k].factors == results[k].factors for k in results)
|
||||
assert results["morning"].score == 40 # 원래 결과는 바뀌지 않는다
|
||||
Reference in new issue
Block a user