Skip to content

Commit

Permalink
languages
Browse files Browse the repository at this point in the history
  • Loading branch information
LauraMBraun committed Aug 1, 2023
1 parent 5867e0f commit 391904a
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"python.testing.pytestArgs": [
"tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
}
2 changes: 1 addition & 1 deletion saa/luga/de/_init_.py → saa/luga/de/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
30 changes: 30 additions & 0 deletions tests/test_clock/test_clock_de.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 391904a

Please sign in to comment.