From ea34bd8a17c58a8be1abc5e8615f9fbfc5c01614 Mon Sep 17 00:00:00 2001 From: Andrew Tavis McAllister Date: Sun, 13 Oct 2024 00:06:04 +0200 Subject: [PATCH] #292 Remove tests for translation --- docs/source/scribe_data/cli.rst | 6 +----- src/scribe_data/cli/cli_utils.py | 2 +- src/scribe_data/cli/total.py | 4 ++-- .../resources/data_type_metadata.json | 1 - tests/cli/test_list.py | 2 -- tests/cli/test_utils.py | 20 ------------------- 6 files changed, 4 insertions(+), 31 deletions(-) diff --git a/docs/source/scribe_data/cli.rst b/docs/source/scribe_data/cli.rst index 7d5b04378..b3effbff4 100644 --- a/docs/source/scribe_data/cli.rst +++ b/docs/source/scribe_data/cli.rst @@ -68,7 +68,6 @@ Example output: emoji-keywords nouns prepositions - translations verbs ----------------------------------- @@ -96,7 +95,6 @@ Example output: emoji-keywords nouns prepositions - translations verbs ----------------------------------- @@ -118,7 +116,6 @@ Example output: emoji-keywords nouns prepositions - translations verbs ----------------------------------- @@ -222,8 +219,7 @@ Interactive Mode 2. emoji_keywords 3. nouns 4. prepositions - 5. translations - 6. verbs + 5. verbs ... diff --git a/src/scribe_data/cli/cli_utils.py b/src/scribe_data/cli/cli_utils.py index c7b8011de..ecf8b6213 100644 --- a/src/scribe_data/cli/cli_utils.py +++ b/src/scribe_data/cli/cli_utils.py @@ -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}") diff --git a/src/scribe_data/cli/total.py b/src/scribe_data/cli/total.py index ddf52a94d..8087d3c26 100644 --- a/src/scribe_data/cli/total.py +++ b/src/scribe_data/cli/total.py @@ -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) @@ -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] diff --git a/src/scribe_data/resources/data_type_metadata.json b/src/scribe_data/resources/data_type_metadata.json index c1e3d6624..ff6249f10 100644 --- a/src/scribe_data/resources/data_type_metadata.json +++ b/src/scribe_data/resources/data_type_metadata.json @@ -11,6 +11,5 @@ "prepositions": "Q4833830", "pronouns": "Q36224", "proper_nouns": "Q147276", - "translations": "", "verbs": "Q24905" } diff --git a/tests/cli/test_list.py b/tests/cli/test_list.py index 541fb2748..1ec2ec1e4 100644 --- a/tests/cli/test_list.py +++ b/tests/cli/test_list.py @@ -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(), @@ -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(), diff --git a/tests/cli/test_utils.py b/tests/cli/test_utils.py index 34b4cc47c..0f75e5a71 100644 --- a/tests/cli/test_utils.py +++ b/tests/cli/test_utils.py @@ -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")) @@ -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 = { @@ -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: