/
Mihaham
/
Table-Time
Обзор
Документация
Войти
/
Mihaham
/
Table-Time
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
services/api/tests/test_shared_scoring.py
64 строки
2 KB
MihahamYT
feat: full game catalog — 46 plugins, docs nav, web UI kit
14 июн 2026, 12:43
14 июн 2026, 12:43
2cd5f50
Код
Авторство
О чём код?
"""Tests for shared scoring module.""" from app.plugins.shared.scoring import ( YATZY_CATEGORIES, empty_yatzy_scorecard, score_yatzy_category, total_yatzy_score, ) def test_empty_scorecard(): card = empty_yatzy_scorecard() assert len(card) == len(YATZY_CATEGORIES) assert all(v is None for v in card.values()) def test_score_ones(): assert score_yatzy_category([1, 1, 3, 4, 5], "ones") == 2 def test_score_yatzy(): assert score_yatzy_category([6, 6, 6, 6, 6], "yatzy") == 50 assert score_yatzy_category([1, 2, 3, 4, 5], "yatzy") == 0 def test_score_full_house(): assert score_yatzy_category([3, 3, 3, 2, 2], "full_house") == 25 assert score_yatzy_category([1, 2, 3, 4, 5], "full_house") == 0 def test_score_small_straight(): assert score_yatzy_category([1, 2, 3, 4, 6], "small_straight") == 30 def test_score_large_straight(): assert score_yatzy_category([2, 3, 4, 5, 6], "large_straight") == 40 def test_score_three_of_kind(): assert score_yatzy_category([3, 3, 3, 1, 2], "three_of_kind") == 12 def test_score_four_of_kind(): assert score_yatzy_category([4, 4, 4, 4, 1], "four_of_kind") == 17 def test_score_chance(): assert score_yatzy_category([1, 2, 3, 4, 5], "chance") == 15 def test_score_upper_section(): assert score_yatzy_category([2, 2, 3, 4, 5], "twos") == 4 assert score_yatzy_category([3, 3, 3, 1, 2], "threes") == 9 assert score_yatzy_category([4, 1, 2, 3, 5], "fours") == 4 assert score_yatzy_category([5, 1, 2, 3, 4], "fives") == 5 assert score_yatzy_category([6, 1, 2, 3, 4], "sixes") == 6 def test_score_unknown_category(): assert score_yatzy_category([1, 2, 3, 4, 5], "invalid") == 0 card = empty_yatzy_scorecard() for cat in ["ones", "twos", "threes", "fours", "fives", "sixes"]: card[cat] = 11 assert total_yatzy_score(card) == 66 + 35