Skip to content

Commit

Permalink
Minor edits to marks to make them less verbose
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtavis committed Oct 7, 2024
1 parent 6a46196 commit de9c931
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions tests/cli/test_get.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,33 @@

import unittest
from unittest.mock import patch

from scribe_data.cli.get import get_data


class TestGetData(unittest.TestCase):
# MARK: Test for subprocess patching
# MARK: Subprocess Patching

@patch("subprocess.run")
def test_get_emoji_keywords(self, mock_subprocess_run):
get_data(language="English", data_type="emoji-keywords")
self.assertTrue(mock_subprocess_run.called)

# MARK: Test for invalid arguments
# MARK: Invalid Arguments

def test_invalid_arguments(self):
with self.assertRaises(ValueError):
get_data()

# MARK: Test for getting all data
# MARK: All Data

@patch("scribe_data.cli.get.query_data")
def test_get_all_data(self, mock_query_data):
get_data(all=True)
mock_query_data.assert_called_once_with(None, None, None, False)

# MARK: Test for specific language and data type
# MARK: Language and Data Type

@patch("scribe_data.cli.get.query_data")
def test_get_specific_language_and_data_type(self, mock_query_data):
get_data(language="german", data_type="nouns", output_dir="./test_output")
Expand All @@ -54,7 +59,8 @@ def test_get_specific_language_and_data_type(self, mock_query_data):
overwrite=False,
)

# MARK: Test for capitalized language input
# MARK: Capitalized Language

@patch("scribe_data.cli.get.query_data")
def test_get_data_with_capitalized_language(self, mock_query_data):
get_data(language="German", data_type="nouns")
Expand All @@ -65,7 +71,8 @@ def test_get_data_with_capitalized_language(self, mock_query_data):
overwrite=False,
)

# MARK: Test for lowercase language input
# MARK: Lowercase Language

@patch("scribe_data.cli.get.query_data")
def test_get_data_with_lowercase_language(self, mock_query_data):
get_data(language="german", data_type="nouns")
Expand All @@ -76,7 +83,8 @@ def test_get_data_with_lowercase_language(self, mock_query_data):
overwrite=False,
)

# MARK: Test for different output directory
# MARK: Output Directory

@patch("scribe_data.cli.get.query_data")
def test_get_data_with_different_output_directory(self, mock_query_data):
get_data(
Expand All @@ -89,7 +97,8 @@ def test_get_data_with_different_output_directory(self, mock_query_data):
overwrite=False,
)

# MARK: Test for overwrite=True
# MARK: Overwrite is True

@patch("scribe_data.cli.get.query_data")
def test_get_data_with_overwrite_true(self, mock_query_data):
get_data(language="English", data_type="verbs", overwrite=True)
Expand All @@ -100,7 +109,8 @@ def test_get_data_with_overwrite_true(self, mock_query_data):
overwrite=True,
)

# MARK: Test for overwrite=False
# MARK: Overwrite is False

@patch("scribe_data.cli.get.query_data")
def test_get_data_with_overwrite_false(self, mock_query_data):
get_data(
Expand Down

0 comments on commit de9c931

Please sign in to comment.