codestyle

This commit is contained in:
s3lph 2021-04-07 09:39:50 +02:00
parent ddcdc0f816
commit 85410e09e5
3 changed files with 5 additions and 3 deletions

View file

@ -380,7 +380,8 @@ class MatematDatabase(object):
product_id, name, price_member, price_non_member, custom_price, stock, stockable = row product_id, name, price_member, price_non_member, custom_price, stock, stockable = row
return Product(product_id, name, price_member, price_non_member, custom_price, stockable, stock) return Product(product_id, name, price_member, price_non_member, custom_price, stockable, stock)
def create_product(self, name: str, price_member: int, price_non_member: int, custom_price: bool, stockable: bool) -> Product: def create_product(self, name: str, price_member: int, price_non_member: int, custom_price:
bool, stockable: bool) -> Product:
""" """
Creates a new product. Creates a new product.
:param name: Name of the product. :param name: Name of the product.

View file

@ -36,4 +36,5 @@ class Product:
self.stockable == other.stockable self.stockable == other.stockable
def __hash__(self) -> int: def __hash__(self) -> int:
return hash((self.id, self.name, self.price_member, self.price_non_member, self.custom_price, self.stock, self.stockable)) return hash((self.id, self.name, self.price_member, self.price_non_member, self.custom_price,
self.stock, self.stockable))

View file

@ -348,7 +348,7 @@ class DatabaseTest(unittest.TestCase):
db.deposit(user1, 1337) db.deposit(user1, 1337)
db.deposit(user2, 4242) db.deposit(user2, 4242)
db.deposit(user3, 1234) db.deposit(user3, 1234)
clubmate = db.create_product('Club Mate', 200, 200, False , True) clubmate = db.create_product('Club Mate', 200, 200, False, True)
florapowermate = db.create_product('Flora Power Mate', 150, 250, False, True) florapowermate = db.create_product('Flora Power Mate', 150, 250, False, True)
fritzmate = db.create_product('Fritz Mate', 200, 200, False, True) fritzmate = db.create_product('Fritz Mate', 200, 200, False, True)