diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..9b38853 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "python.testing.pytestArgs": [ + "tests" + ], + "python.testing.unittestEnabled": false, + "python.testing.pytestEnabled": true +} \ No newline at end of file diff --git a/saa/luga/de/_init_.py b/saa/luga/de/__init__.py similarity index 97% rename from saa/luga/de/_init_.py rename to saa/luga/de/__init__.py index 231249d..467eac1 100644 --- a/saa/luga/de/_init_.py +++ b/saa/luga/de/__init__.py @@ -15,7 +15,7 @@ class Deutsch(Luga): connect_format = "{0}{1}{2}" numbers = { 0: "null", - 1: ("ein", "eine"), + 1: "ein", # ein und zwanzig / eine Minute / ein Uhr 2: "zwei", 3: "drei", 4: "vier", diff --git a/tests/test_clock/test_clock_de.py b/tests/test_clock/test_clock_de.py new file mode 100644 index 0000000..468846f --- /dev/null +++ b/tests/test_clock/test_clock_de.py @@ -0,0 +1,30 @@ +from datetime import time +import pytest +from saa.core.watch import Watch +from saa.core.plugins import supported_languages + +German = supported_languages.get("de") + +test_cases = [ + (time(hour=13, minute=45), German, "viertel vor zwei"), + (time(hour=13, minute=15), German, "viertel nach eins"), + (time(hour=13, minute=30), German, "halb zwei"), +] + + +@pytest.mark.parametrize("test_input, language, test_output", test_cases) +def test_clocks(test_input, language, test_output): + clock = Watch(language=language) + assert test_output == clock(test_input) + + +test_plural_cases = [ + (time(hour=13, minute=1), German, "eine Minute nach eins"), + (time(hour=6, minute=17), German, "siebzehn Minuten nach sechs"), +] + + +@pytest.mark.parametrize("test_input, language, test_output", test_plural_cases) +def test_cases(test_input, language, test_output): + clock = Watch(language=language) + assert test_output == clock(test_input)