def test_inventory_properties(): conjured_item = Conjured('Conjured Item', 6, 30) aged_brie_item = AgedBrie('AgedBrie', 2, 0) backstage_passes = BackstagePasses('BackstagePasses', 15, 20) items = [ conjured_item, aged_brie_item, backstage_passes ] inventory = Inventory() inventory.add_items(items) assert inventory.get_items() == items
def test_to_string_items(): conjured_item = Conjured('Conjured Item', 6, 30) aged_brie_item = AgedBrie('AgedBrie', 2, 0) backstage_passes = BackstagePasses('BackstagePasses', 15, 20) items = [ conjured_item, aged_brie_item, backstage_passes ] inventory = Inventory() inventory.add_items(items) assert inventory.__str__() == "***************Item*************** \n Name: Conjured Item,\n Sell in: 6,\n Quality: 30 \n ***************Item*************** \n Name: AgedBrie,\n Sell in: 2,\n Quality: 0 \n ***************Item*************** \n Name: BackstagePasses,\n Sell in: 15,\n Quality: 20 \n "
def inventory(): """ We don't have create/edit/delete methods yet, but if we would we should refactor this fixture and add teardown() method to cleanup enviroment after running tests """ return Inventory()
def __init__(self, x, y): super().__init__(x, y) self.level = 1 self.gold = 0 self.xp = 0 self.xp_factor = 1 self.damage = 1 self.damage_factor = 1 self.inventory = Inventory() self.steps = 0
def __init__(self, dict): self.__room = Room(dict["room_num"], dict["clean_rating"], dict["electrical_appliance"], dict["sex"]) self.__inventory = Inventory(dict["inventory_name"], dict["name"], dict["surname"], dict["patronymic"], dict["amount"], dict["num_in_queue"]) self.__student = Student(dict["name"], dict["surname"], dict["patronymic"], dict["bd"], dict["email"], dict["faculty"], dict["course"], dict["room_num"], dict["phone_number"], dict["sex"])
def test_update_quality_items(): conjured_item = Conjured('Conjured Item', 6, 30) aged_brie_item = AgedBrie('AgedBrie', 2, 0) backstage_passes = BackstagePasses('BackstagePasses', 15, 20) items = [ conjured_item, aged_brie_item, backstage_passes ] inventory = Inventory() inventory.add_items(items) inventory.update_quality_items() assert inventory.__str__() == "***************Item*************** \n Name: Conjured Item,\n Sell in: 5,\n Quality: 28 \n ***************Item*************** \n Name: AgedBrie,\n Sell in: 1,\n Quality: 1 \n ***************Item*************** \n Name: BackstagePasses,\n Sell in: 14,\n Quality: 21 \n "
def __init__(self, main, mainBun, mainBunNo, mainPatty, mainPattyNo, mainPrice, ingredients=[], ingredientsPrice=0, sides=[], drinks=[], sidePrice=0, drinkPrice=0, status='Not ready'): self._main = main self._mainBun = mainBun self._mainBunNo = mainBunNo self._mainPatty = mainPatty self._mainPattyNo = mainPattyNo self._mainPrice = mainPrice self._ingredients = ingredients self._ingredientsPrice = ingredientsPrice self._sides = sides self._drinks = drinks self._sidePrice = sidePrice self._drinkPrice = drinkPrice self._orderID = random.randint(1, 10) self._status = status self._obj_inventory = Inventory() self._obj_main = Main() if main == 'burger': mainBunList = self._obj_main.bun_type mainQuant = Inventory.mainQuant[mainBunList.index(mainBun)] print( f'Checking inventory... {mainQuant} {mainBun} {main} in stock') print(f'{mainBun} {mainBunNo} buns ordered') else: mainBunList = self._obj_main.bun_type mainQuant = self._obj_inventory.mainQuant[ 2 + mainBunList.index(mainBun)] print(f'Checking inventory... {mainQuant} {mainBun} in stock') print(f'{mainBunNo} buns ordered') pattyList = self._obj_main.patty_type pattyQuant = self._obj_inventory.mainQuant[4 + pattyList.index(mainPatty)] print( f'Checking inventory... {pattyQuant} kg of {mainPatty} patties in sotck' ) print(f'{mainPattyNo} {mainPatty} ordered') if any(ingredients) is True: for i in ingredients: ingredientList = self._obj_inventory.ingredient ingredientQuant = self._obj_inventory.ingredientQuant[ ingredientList.index(i)] print(f'Checking inventory... {ingredientQuant} {i} in stock') if any(sides) is True: for s in sides: sideSplit = s.split(' ') if len(sideSplit) > 1: sideList = self._obj_inventory.side sideOrder = float(sideSplit[0]) sideName = sideSplit[-1] sideQuant = self._obj_inventory.sideQuant[sideList.index( sideName)] if sideName == 'fries': print( f'Checking inventory... {sideQuant} kg of {sideName} in stock' ) print(f'(sideOrder) of {sideName} ordered') else: print( f'Checking inventory... {sideQuant} of {sideName} in stock' ) print(f'{sideOrder} {sideName} ordered') else: print( f'Checking inventory... {sideQuant} of {sideSplit} in stock' ) if any(drinks) is True: for d in drinks: drinkList = self._obj_inventory.side drinkSplit = d.split(' ') drinkName = drinkSplit[-1] drinkType = drinkSplit[1] drinkQuant = self._obj_inventory.sideQuant[drinkList.index( drinkName)] print( f'Checking inventory... {drinkQuant} {drinkType}s of {drinkName} in stock' ) print(f'Here is your order ID: {self._orderID}') print( f'Total cost = ${mainPrice+sidePrice+drinkPrice+ingredientsPrice}')