Exemplo n.º 1
0
from customer import Customer
from supplier import Supplier
from item import Item
from supply import Supply
from order import Order
from admin import Administrator
from review import Review

supply = list()
orders = list()
items = list()
reviews = list()

admin1 = Administrator("iamgod", "iamthelaw", "*****@*****.**")
supplier1 = Supplier("isupply", "4real", "Crab Shack Company", "Van Crabs",
                     "000-112-35-8", "*****@*****.**")
supplier2 = Supplier("isupplytoo", "4real", "Reliable Company", "Van Reliable",
                     "011-112-35-8", "*****@*****.**")
customer1 = Customer("iamguido", "4sure", "Guido", "Van Rossum",
                     "000-112-35-8", "*****@*****.**", "09-09-1968")
item1 = Item("Banana", "Better than ever before", 799.0,
             ("Golden", "Fresh Green"))
item2 = Item("Best Banana", "Better than others", 899.0,
             ("Truly Golden", "Fresher Green"))

review1 = Review('Brilliant', "iamguido", 5)

supply.append(supplier1.add_supply(item1, 10))
supply.append(supplier2.add_supply(item2, 3))

customer1.create_order(item2, 5)
Exemplo n.º 2
0
            logger.info(f"Rating of review '{self.text}' is {self.rating}.")
        else:
            logger.error(
                f"Rating of review {self.text} must to be beetwen 1 and 5!")
            raise ValueError('Rating must to be beetwen 1 and 5!')

        logger.info(f"A review '{self.text}' was created.")

    def __str__(self):
        return f"Review {self.id} \n{self.customer.username} -> {self.item.title}:\
             \n{self.text}, {self.rating} \n({self.status})"

    def __repr__(self):
        return f"{self.id}: {self.text}, {self.rating}"


if __name__ == '__main__':
    from customer import Customer
    from item import Item
    from admin import Administrator

    a1 = Administrator("iamgod", "iamthelaw", "*****@*****.**")
    c1 = Customer("iamguido", "4sure", "Guido", "Van Rossum", "000-112-35-8",
                  "*****@*****.**", "09-09-1968")
    i1 = Item("Banana", "Better than ever before", 799.0,
              ("Golden", "Fresh Green"))
    r1 = Review(c1, i1, 'So delicious', 5)
    a1.approve_review(r1)


Exemplo n.º 3
0
from customer import Customer
from supplier import Supplier
from item import Item
from supply import Supply
from order import Order
from admin import Administrator
from review import Review

supply = list()
orders = list()
items = list()
reviews = list()

admin1 = Administrator("iamgod", "iamthelaw", "*****@*****.**")
supplier1 = Supplier("isupply", "4real", "Crab Shack Company", "Van Crabs",
                     "000-112-35-8", "*****@*****.**")
supplier2 = Supplier("isupplytoo", "4real", "Reliable Company", "Van Reliable",
                     "011-112-35-8", "*****@*****.**")
customer1 = Customer("iamguido", "4sure", "Guido", "Van Rossum",
                     "000-112-35-8", "*****@*****.**", "09-09-1968")
item1 = Item("Banana", "Better than ever before", 799.0,
             ("Golden", "Fresh Green"))
item2 = Item("Best Banana", "Better than others", 899.0,
             ("Truly Golden", "Fresher Green"))

customer1.add_review(item2, "very tasty", 5)
reviews.append(customer1.add_review(item2, "very tasty", 5))