From c33d0225c6f8c5df6fc4b82bb6f4fab288080856 Mon Sep 17 00:00:00 2001 From: cisc0f Date: Sat, 23 Mar 2024 02:33:22 -0400 Subject: [PATCH] Added pylint disable for duplicate code - ignore --- service/models/shop_cart.py | 1 + service/models/shop_cart_item.py | 1 + tests/test_routes.py | 1 + tests/test_shop_cart_item.py | 1 + 4 files changed, 4 insertions(+) diff --git a/service/models/shop_cart.py b/service/models/shop_cart.py index 5dc7eda..5a4b2e5 100644 --- a/service/models/shop_cart.py +++ b/service/models/shop_cart.py @@ -75,6 +75,7 @@ def deserialize(self, data): item = ShopCartItem() item.deserialize(json_item) self.items.append(item) + # pylint: disable=duplicate-code except AttributeError as error: raise DataValidationError("Invalid attribute: " + error.args[0]) from error except KeyError as error: diff --git a/service/models/shop_cart_item.py b/service/models/shop_cart_item.py index 84854ef..822a2f3 100644 --- a/service/models/shop_cart_item.py +++ b/service/models/shop_cart_item.py @@ -54,6 +54,7 @@ def deserialize(self, data): self.product_id = data["product_id"] self.quantity = data["quantity"] self.price = data["price"] + # pylint: disable=duplicate-code except AttributeError as error: raise DataValidationError("Invalid attribute: " + error.args[0]) from error except KeyError as error: diff --git a/tests/test_routes.py b/tests/test_routes.py index ebac58c..61adad2 100644 --- a/tests/test_routes.py +++ b/tests/test_routes.py @@ -26,6 +26,7 @@ class TestShopCartService(TestCase): """REST API Server Tests""" + # pylint: disable=duplicate-code @classmethod def setUpClass(cls): """Run once before all tests""" diff --git a/tests/test_shop_cart_item.py b/tests/test_shop_cart_item.py index bee0158..30bd84f 100644 --- a/tests/test_shop_cart_item.py +++ b/tests/test_shop_cart_item.py @@ -27,6 +27,7 @@ class TestShopCartItem(TestCase): """Shop Cart Item Model CRUD Tests""" + # pylint: disable=duplicate-code @classmethod def setUpClass(cls): """This runs once before the entire test suite"""