Skip to content

Commit

Permalink
#292 Remove tests for translation
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtavis committed Oct 12, 2024
1 parent 2ecc8b4 commit ea34bd8
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 31 deletions.
6 changes: 1 addition & 5 deletions docs/source/scribe_data/cli.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ Example output:
emoji-keywords
nouns
prepositions
translations
verbs
-----------------------------------
Expand Down Expand Up @@ -96,7 +95,6 @@ Example output:
emoji-keywords
nouns
prepositions
translations
verbs
-----------------------------------
Expand All @@ -118,7 +116,6 @@ Example output:
emoji-keywords
nouns
prepositions
translations
verbs
-----------------------------------
Expand Down Expand Up @@ -222,8 +219,7 @@ Interactive Mode
2. emoji_keywords
3. nouns
4. prepositions
5. translations
6. verbs
5. verbs
...
Expand Down
2 changes: 1 addition & 1 deletion src/scribe_data/cli/cli_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def print_formatted_data(data: Union[dict, list], data_type: str) -> None:
emojis = [item["emoji"] for item in value]
print(f"{key:<{max_key_length}} : {' '.join(emojis)}")

elif data_type in {"prepositions", "translations"}:
elif data_type in {"prepositions"}:
for key, value in data.items():
print(f"{key:<{max_key_length}} : {value}")

Expand Down
4 changes: 2 additions & 2 deletions src/scribe_data/cli/total.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def get_datatype_list(language):

data_types = sorted(data_types)

for t in ["autosuggestions", "emoji_keywords", "translations"]:
for t in ["autosuggestions", "emoji_keywords"]:
if t in data_types:
data_types.remove(t)

Expand Down Expand Up @@ -154,7 +154,7 @@ def print_total_lexemes(language: str = None):
first_row = True
if language.startswith("Q") and language[1:].isdigit():
data_types = data_type_metadata
for t in ["autosuggestions", "emoji_keywords", "translations"]:
for t in ["autosuggestions", "emoji_keywords"]:
if t in data_types:
del data_types[t]

Expand Down
1 change: 0 additions & 1 deletion src/scribe_data/resources/data_type_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@
"prepositions": "Q4833830",
"pronouns": "Q36224",
"proper_nouns": "Q147276",
"translations": "",
"verbs": "Q24905"
}
2 changes: 0 additions & 2 deletions tests/cli/test_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ def test_list_data_types_all_languages(self, mock_print):
call("emoji-keywords"),
call("nouns"),
call("prepositions"),
call("translations"),
call("verbs"),
call("-----------------------------------"),
call(),
Expand All @@ -83,7 +82,6 @@ def test_list_data_types_specific_language(self, mock_print):
call("adjectives"),
call("emoji-keywords"),
call("nouns"),
call("translations"),
call("verbs"),
call("-----------------------------"),
call(),
Expand Down
20 changes: 0 additions & 20 deletions tests/cli/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,12 @@ def test_correct_data_type(self):
self.assertEqual(correct_data_type("autosuggestion"), "autosuggestions")
self.assertEqual(correct_data_type("emoji_keyword"), "emoji_keywords")
self.assertEqual(correct_data_type("preposition"), "prepositions")
self.assertEqual(correct_data_type("translation"), "translations")
self.assertEqual(correct_data_type("invalid"), None)

def test_correct_data_type_with_trailing_s(self):
self.assertEqual(correct_data_type("autosuggestions"), "autosuggestions")
self.assertEqual(correct_data_type("emoji_keywords"), "emoji_keywords")
self.assertEqual(correct_data_type("prepositions"), "prepositions")
self.assertEqual(correct_data_type("translations"), "translations")

def test_correct_data_type_invalid_input(self):
self.assertIsNone(correct_data_type("invalid_data_type"))
Expand All @@ -62,17 +60,6 @@ def test_print_formatted_data_emoji_keywords(self, mock_print):
mock_print.assert_any_call("key1 : 😀 😁")
mock_print.assert_any_call("key2 : 😂")

@patch("builtins.print")
def test_print_formatted_data_prepositions_translations(self, mock_print):
data = {"key1": "value1", "key2": "value2"}
print_formatted_data(data, "prepositions")
mock_print.assert_any_call("key1 : value1")
mock_print.assert_any_call("key2 : value2")

print_formatted_data(data, "translations")
mock_print.assert_any_call("key1 : value1")
mock_print.assert_any_call("key2 : value2")

@patch("builtins.print")
def test_print_formatted_data_dict(self, mock_print):
data = {
Expand Down Expand Up @@ -135,13 +122,6 @@ def test_print_formatted_data_prepositions(self):
mock_print.assert_any_call("key1 : value1")
mock_print.assert_any_call("key2 : value2")

def test_print_formatted_data_translations(self):
data = {"key1": "value1", "key2": "value2"}
with patch("builtins.print") as mock_print:
print_formatted_data(data, "translations")
mock_print.assert_any_call("key1 : value1")
mock_print.assert_any_call("key2 : value2")

def test_print_formatted_data_nested_dict(self):
data = {"key1": {"subkey1": "subvalue1", "subkey2": "subvalue2"}}
with patch("builtins.print") as mock_print:
Expand Down

0 comments on commit ea34bd8

Please sign in to comment.