def test_quality_cannot_go_below_zero(self): items = [Item("foo", 0, 0)] items = update(items) self.assertEquals(items[0].quality, 0)
def test_aged_brie_gets_better(self): items = [Item("Aged Brie", 10, 10)] items = update(items) self.assertGreater(items[0].quality, 10)
def test_foo(self): items = [Item("foo", 0, 0)] new_items = update(items) self.assertEquals("foo", new_items[0].name)
def test_degrade_twice_as_fast_after_sellby(self): items = [Item("foo", 1, 10)] new_items = update(update(items)) self.assertEquals(new_items[0].quality, 7)
def test_backstage_passes_have_no_quality_after_concert(self): items = [Item("Backstage passes for MegaMoose", 1, 40)] items = update(update(items)) self.assertEquals(items[0].quality, 0)
def test_backstage_passes_increase_by_three_within_five_days(self): items = [Item("Backstage passes for MegaMoose", 4, 10)] items = update(items) self.assertEquals(items[0].quality, 13)
def test_backstage_passes_increases_quality(self): items = [Item("Backstage passes for MegaMoose", 30, 10)] items = update(items) self.assertGreater(items[0].quality, 10)
def test_sulfuras_is_special(self): items = [Item("The Sulfuras Gauntlet of awesome!", -1, 80)] items = update(items) self.assertEquals(items[0].quality, 80)
def test_maximum_quality_for_items_is_50(self): items = [Item("Aged Brie", 10, 50)] items = update(items) self.assertEquals(items[0].quality, 50)
def test_conjured_item_degrades_twice_as_fast_after_date(self): items = [Item("Conjured Megalodon", -1, 40)] items = update(items) self.assertEquals(items[0].quality, 36)
# -*- coding: utf-8 -*- from __future__ import print_function from gilded_rose import Item, update if __name__ == "__main__": print ("OMGHAI!") items = [ Item(name="+5 Dexterity Vest", sell_in=10, quality=20), Item(name="Aged Brie", sell_in=2, quality=0), Item(name="Elixir of the Mongoose", sell_in=5, quality=7), Item(name="Sulfuras, Hand of Ragnaros", sell_in=0, quality=80), Item(name="Sulfuras, Hand of Ragnaros", sell_in=-1, quality=80), Item(name="Backstage passes to a TAFKAL80ETC concert", sell_in=15, quality=20), Item(name="Backstage passes to a TAFKAL80ETC concert", sell_in=10, quality=49), Item(name="Backstage passes to a TAFKAL80ETC concert", sell_in=5, quality=49), Item(name="Conjured Mana Cake", sell_in=3, quality=6), # <-- :O ] days = 2 import sys if len(sys.argv) > 1: days = int(sys.argv[1]) + 1 for day in range(days): print("-------- day %s --------" % day) print("name, sellIn, quality") for item in items: print(item) print("") items = update(items)