Skip to content

Commit a34d3ce

Browse files
committed
fix(i18n): another fix test
1 parent b1d7d30 commit a34d3ce

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

app/internal/languages.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,12 @@ def set_ui_language(language: str = None) -> None:
5656
# return config.WEBSITE_LANGUAGE
5757

5858

59-
def _get_language_directory():
59+
def _get_language_directory() -> str:
60+
"""Get and return the language directory relative path.
61+
62+
Returns:
63+
str: the language directory relative path.
64+
"""
6065
language_dir = LANGUAGE_DIR
6166
if Path.cwd().name == "tests": # If running from test, change dir path.
6267
language_dir = LANGUAGE_DIR_TEST
@@ -69,6 +74,7 @@ def _get_supported_languages(language_dir: str = None) -> \
6974
7075
Args:
7176
language_dir (str, optional): the path of the language directory.
77+
Defaults to None.
7278
7379
Returns:
7480
Generator[str, Any, None]: a generator expression of supported

tests/test_language.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ def test_get_supported_languages():
4242
number_of_languages = len(list(languages._get_supported_languages()))
4343
assert number_of_languages == TestLanguage.NUMBER_OF_LANGUAGES
4444

45+
@staticmethod
46+
def test_get_language_directory():
47+
pytest.MonkeyPatch().chdir(languages.LANGUAGE_DIR_TEST)
48+
assert languages._get_language_directory()
49+
4550
@staticmethod
4651
def test_get_display_language():
4752
# TODO: Waiting for user registration.

0 commit comments

Comments
 (0)