File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,12 @@ def set_ui_language(language: str = None) -> None:
56
56
# return config.WEBSITE_LANGUAGE
57
57
58
58
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
+ """
60
65
language_dir = LANGUAGE_DIR
61
66
if Path .cwd ().name == "tests" : # If running from test, change dir path.
62
67
language_dir = LANGUAGE_DIR_TEST
@@ -69,6 +74,7 @@ def _get_supported_languages(language_dir: str = None) -> \
69
74
70
75
Args:
71
76
language_dir (str, optional): the path of the language directory.
77
+ Defaults to None.
72
78
73
79
Returns:
74
80
Generator[str, Any, None]: a generator expression of supported
Original file line number Diff line number Diff line change @@ -42,6 +42,11 @@ def test_get_supported_languages():
42
42
number_of_languages = len (list (languages ._get_supported_languages ()))
43
43
assert number_of_languages == TestLanguage .NUMBER_OF_LANGUAGES
44
44
45
+ @staticmethod
46
+ def test_get_language_directory ():
47
+ pytest .MonkeyPatch ().chdir (languages .LANGUAGE_DIR_TEST )
48
+ assert languages ._get_language_directory ()
49
+
45
50
@staticmethod
46
51
def test_get_display_language ():
47
52
# TODO: Waiting for user registration.
You can’t perform that action at this time.
0 commit comments