fix: 각 점수에 중요도 배율을 반영해 화면 점수와 순위를 일치시킴
This commit is contained in:
1 parent
621a0cf90d
commit
d5f8b148b4
12 files changed
+68
-33
No files matched your search
@@ -9,7 +9,7 @@ import pytest
|
||||
from common.enums import RainType, Sky
|
||||
from services.calc.index_calc import (
|
||||
OUTING_HOURS, Context, DayForecast, Hour, air_score, axis_label, estimate, evaluate, hour_temp, outing, outing_estimate, rain_score, sun_score, temp_score,
|
||||
uv_score, view_score, zero_rules_text,
|
||||
priority_score, rank_score, uv_score, view_score, zero_rules_text,
|
||||
)
|
||||
from services.calc.moon import illumination
|
||||
|
||||
@@ -38,6 +38,20 @@ def test_perfect_evening_scores_100():
|
||||
assert r.notes["temp"] == "체감 21°, 편한 범위 18~24° 안"
|
||||
|
||||
|
||||
def test_rank_and_display_share_priority_adjusted_screenshot_scores():
|
||||
items = [(83, 1), (82, 1), (80, 1), (91, 2), (77, 1), (77, 1), (76, 1), (89, 2), (87, 2)]
|
||||
shown = [(priority_score(score, priority), priority) for score, priority in items]
|
||||
ranked = sorted(shown, key=lambda item: rank_score(*item), reverse=True)
|
||||
assert [score for score, _ in ranked] == [83, 82, 80, 77, 77, 77, 76, 76, 74]
|
||||
assert priority_score(91, 2) == 77
|
||||
assert priority_score(89, 2) == 76
|
||||
|
||||
|
||||
def test_rank_uses_priority_only_to_break_ties():
|
||||
items = [(80, 3), (80, 1), (81, 3), (80, 2)]
|
||||
assert sorted(items, key=lambda item: rank_score(*item), reverse=True) == [(81, 3), (80, 1), (80, 2), (80, 3)]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("weight", [5, 10, 20])
|
||||
def test_time_match_adds_only_its_weight_without_extra_penalty(weight):
|
||||
rules = _defn().factor_rules | {"time": {"type": "fixed", "value": 55}}
|
||||
|
||||
Reference in new issue
Block a user