/
/
/
1"""Tests for Music Quiz scoring helpers."""
2
3from __future__ import annotations
4
5from music_assistant.providers.music_quiz.scoring import calculate_linear_scores
6
7
8def test_calculate_linear_scores_without_correct_answers() -> None:
9 """Return no scores when no player answered correctly."""
10 assert calculate_linear_scores([]) == {}
11
12
13def test_calculate_linear_scores_single_correct_answer() -> None:
14 """Award max points to the only correct answer."""
15 assert calculate_linear_scores(["player_1"]) == {"player_1": 1000}
16
17
18def test_calculate_linear_scores_multiple_correct_answers() -> None:
19 """Award linearly descending scores in answer order."""
20 assert calculate_linear_scores(["player_1", "player_2", "player_3"]) == {
21 "player_1": 1000,
22 "player_2": 667,
23 "player_3": 333,
24 }
25
26
27def test_calculate_linear_scores_four_correct_answers() -> None:
28 """Award deterministic scores for four correct answers."""
29 assert calculate_linear_scores(["p1", "p2", "p3", "p4"]) == {
30 "p1": 1000,
31 "p2": 750,
32 "p3": 500,
33 "p4": 250,
34 }
35