def update_item_quality(item): ItemService.reduce_item_sell_in(item) if item.sell_in in range(6, 11): BackstageService.increase_item_quality(item, 2) return item.quality elif item.sell_in in range(0, 6): BackstageService.increase_item_quality(item, 3) return item.quality elif item.sell_in < 0: BackstageService.set_item_quality(item, 0) return item.quality else: BackstageService.increase_item_quality(item, 1) return item.quality
def test_can_reduce_item_sell_in(self): item = Item("Sulfuras", 20, 80) item2 = Item("AgedBrie", "20", 50) expected_value = item.sell_in - 1 self.assertTrue( ItemService.reduce_item_sell_in(item) == expected_value) self.assertRaises(TypeError, ItemService.reduce_item_sell_in, item2)
def update_item(item): ItemService.reduce_item_sell_in(item) AgedBrieService.increase_item_quality(item, 1) return item.quality, item.sell_in
def update_item(item): SulfuraService.set_item_quality(item) ItemService.reduce_item_sell_in(item) return item.quality, item.sell_in
def update_item_quality(item): ItemService.reduce_item_sell_in(item) StandardItemService.reduce_item_quality_by(item, 1) return item.quality, item.sell_in
def update_quality(item): ItemService.reduce_item_sell_in(item) ConjuredService.reduce_item_quality(item, 2) return item.quality