# Copyright (c) 2026 Krzysztof Rudnicki. MIT licence. """Polish number agreement, which the group notices the moment it is wrong.""" from __future__ import annotations import pytest from signal_bot.stats import text @pytest.mark.parametrize( ("count", "expected"), [ (0, "0 znaków"), (1, "1 znak"), (2, "2 znaki"), (4, "4 znaki"), (5, "5 znaków"), (11, "11 znaków"), # The teens take the many-form even though they end in 2, 3 and 4 -- # the rule reads the last two digits, not the last one. (12, "12 znaków"), (13, "13 znaków"), (14, "14 znaków"), (21, "21 znaków"), (22, "22 znaki"), (24, "24 znaki"), (25, "25 znaków"), (44, "44 znaki"), (112, "112 znaków"), (122, "122 znaki"), ], ) def test_characters_agree(count: int, expected: str) -> None: assert text.characters(count) == expected @pytest.mark.parametrize( ("count", "expected"), [(1, "1 wiadomość"), (2, "2 wiadomości"), (5, "5 wiadomości"), (220, "220 wiadomości")], ) def test_messages_agree(count: int, expected: str) -> None: assert text.messages(count) == expected @pytest.mark.parametrize( ("count", "expected"), [(1, "1 komenda"), (4, "4 komendy"), (5, "5 komend")] ) def test_commands_agree(count: int, expected: str) -> None: assert text.commands(count) == expected @pytest.mark.parametrize(("count", "expected"), [(1, "1 osoba"), (3, "3 osoby"), (7, "7 osób")]) def test_people_agree(count: int, expected: str) -> None: assert text.people(count) == expected @pytest.mark.parametrize(("count", "expected"), [(1, "1 dzień"), (2, "2 dni"), (9, "9 dni")]) def test_days_agree(count: int, expected: str) -> None: assert text.days(count) == expected @pytest.mark.parametrize( ("count", "expected"), [ (67, "67 🤷"), (69, "69 (nice)"), (314, "314 🥧"), (420, "420 🌿"), (1410, "1410 ⚔️"), (1916, "1916 🇵🇱"), (2137, "2137 🙏"), (68, "68"), (0, "0"), (21370, "21370"), ], ) def test_the_numbers_the_group_reacts_to_carry_their_marker(count: int, expected: str) -> None: assert text.marked(count) == expected def test_the_marker_sticks_to_the_number_in_front_of_its_noun() -> None: assert text.messages(69) == "69 (nice) wiadomości" assert text.commands(2137) == "2137 🙏 komend" assert text.people(67) == "67 🤷 osób" assert text.days(1410) == "1410 ⚔️ dni" def test_an_average_is_not_a_count_and_stays_bare() -> None: """ "średnio 69 znaków" is a mean: nobody wrote it, so nothing is marked.""" assert text.characters(69) == "69 znaków"