From: Shane Jaroch Date: Thu, 18 Apr 2024 19:12:55 +0000 (-0400) Subject: make `_aggregate_rows()` method private X-Git-Tag: v0.2.8.dev2~26 X-Git-Url: https://git.nutra.tk/v2?a=commitdiff_plain;h=dc58727397e9a6341406b26f5c439f1988af3998;p=nutratech%2Fcli.git make `_aggregate_rows()` method private --- diff --git a/ntclient/models/__init__.py b/ntclient/models/__init__.py index 5f39fbd..bea2910 100644 --- a/ntclient/models/__init__.py +++ b/ntclient/models/__init__.py @@ -27,7 +27,7 @@ class Recipe: self.food_data = {} # type: ignore - def aggregate_rows(self) -> tuple: + def _aggregate_rows(self) -> tuple: """Aggregate rows into a tuple""" print("Processing recipe file: %s" % self.file_path) with open(self.file_path, "r", encoding="utf-8") as _file: @@ -44,7 +44,7 @@ class Recipe: """ # Read into memory - self.rows = self.aggregate_rows() + self.rows = self._aggregate_rows() # Validate data uuids = {x["recipe_id"] for x in self.rows} diff --git a/tests/services/test_recipe.py b/tests/services/test_recipe.py index 76a2f05..c6c2cc3 100644 --- a/tests/services/test_recipe.py +++ b/tests/services/test_recipe.py @@ -38,7 +38,7 @@ class TestRecipe(unittest.TestCase): """Raises key error if recipe uuids are not unique""" # TODO: return_value should be a list of recipe dicts, each with a 'uuid' key with patch( - "ntclient.models.Recipe.aggregate_rows", + "ntclient.models.Recipe._aggregate_rows", return_value=[{"recipe_id": "UUID_1"}, {"recipe_id": "UUID_2"}], ): with pytest.raises(KeyError):