コード例 #1
0
 def test_foo(self):
     items = [Item("foo", 0, 0)]
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     self.assertEquals("foo", items[0].name)
     self.assertEqual(0, items[0].quality)
     self.assertEqual(-1, items[0].sell_in)
コード例 #2
0
ファイル: test_gilded_rose.py プロジェクト: Nikolao/kata
 def test_quality_is_never_negative(self):
     items = [ItemFactory("foo", 3, 1)]
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     self.assertTrue(items[0].quality == 0)
     gilded_rose.update_quality()
     self.assertTrue(items[0].quality == 0)
コード例 #3
0
	def test_QualityMax(self):
		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="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),
				]
		gilded_rose = GildedRose(items)

		#We test by running update on the input items until either 
		#	1) quality has stabilized (success)
		#	2) quality of any item exceeds 50 (failure)
		#	3) 100 iterations have taken place (failure)
		is_stable = False
		num_iterations = 0
		max_num_iters = 100
		qualities_prev = gilded_rose.Qualities()
		while not is_stable:			
			num_iterations += 1
			self.assertLessEqual(num_iterations, max_num_iters, \
									"Quality not stabilized after " + str(max_num_iters) + " iterations")
			
			gilded_rose.update_quality()
			qualities = gilded_rose.Qualities()
			is_stable = True
			for q, qp in zip(qualities, qualities_prev):
				self.assertLessEqual(q, gilded_rose.quality_max, "Quality exceeds max allowed")
				if q != qp:
					is_stable = False;
			qualities_prev = qualities
コード例 #4
0
    def test_increases_the_quality_by_three_of_the_products_that_get_better_as_they_age_when_there_are_5_days_or_less_left(self):
        item = Item("Backstage passes to a TAFKAL80ETC concert", 5, 15)

        gilded_rose = GildedRose([item])
        gilded_rose.update_quality()

        self._assert_quality_and_sell_in(item, sell_in=4, quality=18)
コード例 #5
0
    def test_quality_zero_for_backstage_passes_and_brie_when_we_have_passed_the_sell_in_date(self):
        item = Item("Backstage passes to a TAFKAL80ETC concert", 0, 20)

        gilded_rose = GildedRose([item])
        gilded_rose.update_quality()

        self._assert_quality_and_sell_in(item, sell_in=-1, quality=0)
コード例 #6
0
    def test_increase_quality_by_two_for_products_that_get_better_as_they_age_and_there_are_10_days_or_less_left(self):
        item = Item("Backstage passes to a TAFKAL80ETC concert", 8, 30)

        gilded_rose = GildedRose([item])
        gilded_rose.update_quality()

        self._assert_quality_and_sell_in(item, sell_in=7, quality=32)
コード例 #7
0
 def test_backstage(self):
     items = [
         Item("Backstage passes to a TAFKAL80ETC concert", 11, 30),
         Item("Backstage passes to a TAFKAL80ETC concert", 10, 30),
         Item("Backstage passes to a TAFKAL80ETC concert", 6, 30),
         Item("Backstage passes to a TAFKAL80ETC concert", 5, 30),
         Item("Backstage passes to a TAFKAL80ETC concert", -1, 30)
         ]
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     self.assertEqual(31, gilded_rose.items[0].quality)
     self.assertEqual(32, gilded_rose.items[1].quality)
     self.assertEqual(32, gilded_rose.items[2].quality)
     self.assertEqual(33, gilded_rose.items[3].quality)
     self.assertEqual(0, gilded_rose.items[4].quality)
     self.assertEqual(10, gilded_rose.items[0].sell_in)
     self.assertEqual(9, gilded_rose.items[1].sell_in)
     self.assertEqual(5, gilded_rose.items[2].sell_in)
     self.assertEqual(4, gilded_rose.items[3].sell_in)
     self.assertEqual(-2, gilded_rose.items[4].sell_in)
     # one more day
     gilded_rose.update_quality()
     self.assertEqual(33, gilded_rose.items[0].quality)
     self.assertEqual(34, gilded_rose.items[1].quality)
     self.assertEqual(35, gilded_rose.items[2].quality)
     self.assertEqual(36, gilded_rose.items[3].quality)
     self.assertEqual(0, gilded_rose.items[4].quality)
     self.assertEqual(9, gilded_rose.items[0].sell_in)
     self.assertEqual(8, gilded_rose.items[1].sell_in)
     self.assertEqual(4, gilded_rose.items[2].sell_in)
     self.assertEqual(3, gilded_rose.items[3].sell_in)
     self.assertEqual(-3, gilded_rose.items[4].sell_in)
コード例 #8
0
ファイル: test_gilded_rose.py プロジェクト: Nikolao/kata
 def test_quality_decreases_faster_after_date_passed(self):
     items = [ItemFactory("foo", 2, 4)]
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     self.assertEquals(3, items[0].quality)
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     self.assertEquals(1, items[0].quality)
コード例 #9
0
ファイル: test_gilded_rose.py プロジェクト: anishpdalal/katas
 def test_quality_never_negative(self):
 	item1 = Item("food", 0, 1)
 	item2 = Item("food", 1, 0)
 	gilded_rose1 = GildedRose(item1)
 	gilded_rose2 = GildedRose(item2)
 	gilded_rose1.update_quality()
 	gilded_rose2.update_quality()
 	self.assertEqual(gilded_rose1.item.quality, 0)
 	self.assertEqual(gilded_rose2.item.quality, 0)
コード例 #10
0
ファイル: test_gilded_rose.py プロジェクト: anishpdalal/katas
 def test_quality_fifty_threshold(self):
 	item1 = Item("Aged Brie", -2, 49.5)
 	item2 = Item("Aged Brie", -2, 49)
 	gilded_rose1 = GildedRose(item1)
 	gilded_rose2 = GildedRose(item2)
 	gilded_rose1.update_quality()
 	gilded_rose2.update_quality()
 	self.assertEqual(gilded_rose1.item.quality, 50)
 	self.assertEqual(gilded_rose2.item.quality, 50)
コード例 #11
0
	def test_QualityBrie(self):
		items = [Item(name="Aged Brie", sell_in=10, quality=0),
				Item(name="Aged Brie", sell_in=10, quality=0),
				]
		gilded_rose = GildedRose(items)
		gilded_rose.update_quality()
		qualities = gilded_rose.Qualities()
		for q in qualities:
			self.assertGreater(q, 0, "Brie quality did not increase")
コード例 #12
0
def test_modified(item, tstexpect):
    gr = GildedRose(list([item]))
    print(gr.items)

    for expected in tstexpect:
        gr.update_quality()
        ref = gr.items[0]
        print(expected, ref.sell_in, ref.quality)
        assert expected == [ref.sell_in, ref.quality]
コード例 #13
0
    def test_decreses_by_one_the_quality_and_sell_in_for_regular_items(self):
        items = [
                Item("+5 Dexterity Vest", 10, 20),
                Item("Conjured Mana Cake", 3,6)
        ]
        gilded_rose = GildedRose(items)
        gilded_rose.update_quality()

        self._assert_quality_and_sell_in(items[0], sell_in=9, quality=19)
        self._assert_quality_and_sell_in(items[1], sell_in=2, quality=5)
コード例 #14
0
    def test_decreases_the_quality_of_the_rpoducts_twice_as_fast_when_we_have_passed_the_sell_in_date(self):
        items = [
                Item("+5 Dexterity Vest", 0, 20),
                Item("Conjured Mana Cake", 0, 6)
        ]
        gilded_rose = GildedRose(items)
        gilded_rose.update_quality()

        self._assert_quality_and_sell_in(items[0], sell_in=-1, quality=18)
        self._assert_quality_and_sell_in(items[1], sell_in=-1, quality=4)
コード例 #15
0
	def test_Sulfuras(self):
		items = [Item(name="Sulfuras, Hand of Ragnaros", sell_in=0, quality=80)]
		gilded_rose = GildedRose(items)
		quality_pre = gilded_rose.Qualities()[0]
		sell_in_pre = gilded_rose.SellIns()[0]
		gilded_rose.update_quality()
		quality_post = gilded_rose.Qualities()[0]
		sell_in_post = gilded_rose.SellIns()[0]
		self.assertEqual(quality_pre, quality_post, "Sulfuras quality has changed")
		self.assertEqual(sell_in_pre, sell_in_post, "Sulfuras sell-in value changed")
コード例 #16
0
    def test_increases_quality_by_one_for_products_that_get_better_as_they_age(self):
        items = [
                Item("Aged Brie", 20, 30),
                Item("Backstage passes to a TAFKAL80ETC concert", 20, 30)
        ]
        gilded_rose = GildedRose(items)
        gilded_rose.update_quality()

        self._assert_quality_and_sell_in(items[0], sell_in=19, quality=31)
        self._assert_quality_and_sell_in(items[1], sell_in=19, quality=31)
コード例 #17
0
ファイル: test_gilded_rose.py プロジェクト: Nikolao/kata
 def test_backstage_passes_drops_in_quality_after_date(self):
     items = [ItemFactory(name="Backstage passes to a TAFKAL80ETC concert",
                   sell_in=2, quality=10)]
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     self.assertEquals(1, items[0].sell_in)
     self.assertEquals(13, items[0].quality)
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     self.assertEquals(0, items[0].sell_in)
     self.assertEquals(0, items[0].quality)
コード例 #18
0
ファイル: test_gilded_rose.py プロジェクト: Nikolao/kata
 def test_backstage_passes_increases_in_quality_by_3(self):
     items = [ItemFactory(name="Backstage passes to a TAFKAL80ETC concert",
                   sell_in=7, quality=10)]
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     self.assertEquals(6, items[0].sell_in)
     self.assertEquals(12, items[0].quality)
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     self.assertEquals(5, items[0].sell_in)
     self.assertEquals(15, items[0].quality)
コード例 #19
0
 def test_past_date(self):
     items = [
         Item("Regular thing", 0, 4),
         Item("Other thing", 1, 2),
         Item("Widget 33", 1, 5)
         ]
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     self.assertEqual(2, gilded_rose.items[0].quality)
     self.assertEqual(1, gilded_rose.items[1].quality)
     self.assertEqual(4, gilded_rose.items[2].quality)
     gilded_rose.update_quality()
     self.assertEqual(0, gilded_rose.items[0].quality)
     self.assertEqual(0, gilded_rose.items[1].quality)
     self.assertEqual(2, gilded_rose.items[2].quality)
コード例 #20
0
	def test_DefaultQualityDec(self):
		items = [Item(name="+5 Dexterity Vest", sell_in=-1, quality=20),
				Item(name="Elixir of the Mongoose", sell_in=-1, quality=7),
				]
		gilded_rose = GildedRose(items)

		#Test that the basic decrease is positive:
		self.assertGreater(gilded_rose.default_qual_dec, 0)
		
		#Now test that for ordinary items, the decrease doubles after the SellIn rate
		quality_pre = gilded_rose.Qualities()
		gilded_rose.update_quality()
		quality_post = gilded_rose.Qualities()

		for i in range(0, len(items)):
			self.assertEqual(quality_pre[i]-quality_post[i], 2*gilded_rose.default_qual_dec, \
								"Quality decrement not doubling after sellIn==0")
コード例 #21
0
	def test_QualityConjured(self):
		items = [Item(name="Conjured Mana Cake", sell_in=10, quality=6),
				Item(name="Conjured Mana Cake", sell_in=-10, quality=6)]
		gilded_rose = GildedRose(items)
		qualities_pre = gilded_rose.Qualities()
		gilded_rose.update_quality()
		qualities_post = gilded_rose.Qualities()
		
		#Sell-In >=0
		default_conj_dec = 2 * gilded_rose.default_qual_dec
		self.assertEqual(qualities_pre[0] - qualities_post[0], default_conj_dec, \
							"Invalid Conjured item default decrement")

		#Sell-In < 0
		overdue_conj_dec = 4 * gilded_rose.default_qual_dec
		self.assertEqual(qualities_pre[1] - qualities_post[1], overdue_conj_dec, \
							"Invalid Conjured item overdue decrement")
コード例 #22
0
 def test_sulfuras(self):
     items = [
         Item("Sulfuras, Hand of Ragnaros", 20, 20),
         Item("Sulfuras, Hand of Ragnaros", 0, 80),
         Item("Sulfuras, Hand of Ragnaros", -12, 0),
         Item("Sulfuras, Hand of Ragnaros", 2, 50),
         ]
     gilded_rose = GildedRose(items)
     for _ in range(50):
         gilded_rose.update_quality()
         self.assertEqual(20, gilded_rose.items[0].quality)
         self.assertEqual(80, gilded_rose.items[1].quality)
         self.assertEqual(0, gilded_rose.items[2].quality)
         self.assertEqual(50, gilded_rose.items[3].quality)
         self.assertEqual(20, gilded_rose.items[0].sell_in)
         self.assertEqual(0, gilded_rose.items[1].sell_in)
         self.assertEqual(-12, gilded_rose.items[2].sell_in)
         self.assertEqual(2, gilded_rose.items[3].sell_in)
コード例 #23
0
 def test_brie(self):
     items = [Item("Aged Brie", 2, 46)]
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     self.assertEqual("Aged Brie", gilded_rose.items[0].name)
     self.assertEqual(47, gilded_rose.items[0].quality)
     gilded_rose.update_quality()
     self.assertEqual(48, gilded_rose.items[0].quality)
     gilded_rose.update_quality() #increase by 2 now
     self.assertEqual(50, gilded_rose.items[0].quality)
     gilded_rose.update_quality()
     self.assertEqual(50, gilded_rose.items[0].quality)
コード例 #24
0
	def test_SellIn(self):
		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="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),
				]
		gilded_rose = GildedRose(items)
		
		sell_ins_pre = gilded_rose.SellIns()
		gilded_rose.update_quality()
		sell_ins_post = gilded_rose.SellIns()
		
		for i in range(0, len(items)):
			self.assertEqual(sell_ins_post[i] - sell_ins_pre[i], -1, \
							"Sell-In value not decrementing")
コード例 #25
0
	def test_QualityZero(self):
		items = [Item(name="+5 Dexterity Vest", sell_in=10, quality=0),
				Item(name="Aged Brie", sell_in=10, quality=0),
				Item(name="Sulfuras, Hand of Ragnaros", sell_in=10, quality=0),
				Item(name="Elixir of the Mongoose", sell_in=10, quality=0),
				Item(name="Backstage passes to a TAFKAL80ETC concert", sell_in=10, quality=0),
				Item(name="Conjured Mana Cake", sell_in=10, quality=0),
				Item(name="+5 Dexterity Vest", sell_in=-10, quality=0),
				Item(name="Aged Brie", sell_in=-10, quality=0),
				Item(name="Sulfuras, Hand of Ragnaros", sell_in=-10, quality=0),
				Item(name="Elixir of the Mongoose", sell_in=-10, quality=0),
				Item(name="Backstage passes to a TAFKAL80ETC concert", sell_in=-10, quality=0),
				Item(name="Conjured Mana Cake", sell_in=-10, quality=0),
				]
		gilded_rose = GildedRose(items)

		gilded_rose.update_quality()
		quality_post = gilded_rose.Qualities()

		for quality in quality_post:
			self.assertGreaterEqual(quality, 0, "Invalid quality decrease")
コード例 #26
0
class GildedRoseTextTest(object):
    def __init__(self, items):
        self.items = items
        self.GildedRose = GildedRose(self.items)

    def run(self, days):
        self.printHead()
        for day in range(days):
            self.printDay(day)
            self.next_day()

    def next_day(self):
        self.GildedRose.update_quality()

    def printDay(self, day):
        print "-------- day %s --------" % day
        print "name, sellIn, quality"
        for item in self.items:
            print item
        print

    def printHead(self):
        print "OMGHAI!"
コード例 #27
0
	def test_BackstagePass(self):
		items = [Item(name="Backstage passes to a TAFKAL80ETC concert", sell_in=15, quality=20)]
		gilded_rose = GildedRose(items)
		sell_in = gilded_rose.SellIns()[0]
		prev_quality = gilded_rose.Qualities()[0]
		#The loop iterates through all phases of backstage pass valuation, from 
		#>10 days out to past-sellby
		while sell_in >= -1:
			gilded_rose.update_quality()
			quality = gilded_rose.Qualities()[0]
			if sell_in<0:
				self.assertEqual(quality, 0, "Backstage pass not 0 after sell-by date")
			else:
				if sell_in<=5:
					expected_inc = min(gilded_rose.quality_max-prev_quality, 3)
				elif sell_in<=10:
					expected_inc = min(gilded_rose.quality_max-prev_quality, 2)
				else:
					expected_inc = min(gilded_rose.quality_max-prev_quality, 1)
				self.assertEqual(quality - prev_quality, expected_inc, \
						"Backstage pass value not changing appropriately at sell_in value " + str(sell_in))
			prev_quality = quality
			sell_in = gilded_rose.SellIns()[0]
コード例 #28
0
 def test_conjured(self):
     items = [Item("Conjured Mana Cake", 2, 7)]
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     self.assertEqual(5, gilded_rose.items[0].quality)
     self.assertEqual(1, gilded_rose.items[0].sell_in)
     # one more day
     gilded_rose.update_quality()
     self.assertEqual(3, gilded_rose.items[0].quality)
     self.assertEqual(0, gilded_rose.items[0].sell_in)
     # one more day again
     gilded_rose.update_quality()
     self.assertEqual(0, gilded_rose.items[0].quality)
     self.assertEqual(-1, gilded_rose.items[0].sell_in)
コード例 #29
0
def test_foo():
    gilded_rose = GildedRose([Item("foo", 0, 0)])
    gilded_rose.update_quality()
    assert "FixMe" == gilded_rose.items[0].name
コード例 #30
0
 def test_conjured(self):
     items = [Item(name="Conjured Mana Cake", sell_in=3, quality=6)]
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     self.assertEqual(4, items[0].quality)
コード例 #31
0
ファイル: test_gilded_rose.py プロジェクト: mjcowdrill/python
def test_update_quality(item_name, initial_quality, initial_sellin, updated_quality, updated_sellin, comment):
    item = Item(item_name, initial_sellin, initial_quality)
    gilded_rose = GildedRose([item])
    gilded_rose.update_quality()
    assert item.quality == updated_quality
    assert item.sell_in == updated_sellin
コード例 #32
0
ファイル: test_gilded_rose.py プロジェクト: ericgarig/misc
 def test_passes_expired(self):
     """Test condition."""
     items = [Item("Backstage passes to a TAFKAL80ETC concert", 0, 0)]
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     self.assertEqual([-1, 0], [items[0].sell_in, items[0].quality])
コード例 #33
0
 def test_quality_negative(self):
     items = [Item("foo", sell_in=5, quality=0)]
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     self.assertFalse(0 > items[0].quality)
コード例 #34
0
ファイル: test_gilded_rose.py プロジェクト: ericgarig/misc
 def test_item_decreases(self):
     """Test condition."""
     items = [Item("Vest of Agility", 4, 4)]
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     self.assertEqual([3, 3], [items[0].sell_in, items[0].quality])
コード例 #35
0
 def test_sulfuras_sell_in(self):
     items = [Item("Sulfuras, Hand of Ragnaros", 0, 20)]
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     self.assertEquals(0, items[0].sell_in)
コード例 #36
0
 def test_mongoose_sell_in(self):
     items = [Item("Elixir of the Mongoose", 10, 20)]
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     self.assertEquals(9, items[0].sell_in)
コード例 #37
0
 def test_vest_sell_in(self):
     items = [Item("+5 Dexterity Vest", 10, 20)]
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     self.assertEquals(9, items[0].sell_in)
コード例 #38
0
 def test_concert_sell_in(self):
     items = [Item("Backstage passes to a TAFKAL80ETC concert", 10, 20)]
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     self.assertEquals(9, items[0].sell_in)
コード例 #39
0
 def test_foo(self):
     items = [Item("foo", 0, 0)]
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     self.assertEquals("fixme", items[0].name)
コード例 #40
0
 def test_conjured_min(self):
     items = [Item("Conjured Mana Cake", 5, 0)]
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     self.assertEquals(0, items[0].quality)
コード例 #41
0
 def test_conjured_expired(self):
     items = [Item("Conjured Mana Cake", 0, 20)]
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     self.assertEquals(16, items[0].quality)
コード例 #42
0
 def test_brie_max(self):
     items = [Item("Aged Brie", 12, 49)]
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     self.assertEquals(50, items[0].quality)
コード例 #43
0
 def test_brie_quality_increase(self):
     items = [Item("Aged Brie", sell_in=2, quality=0)]
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     self.assertEqual(1, items[0].quality)
コード例 #44
0
 def test_brie_sell_in(self):
     items = [Item("Aged Brie", 10, 20)]
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     self.assertEquals(9, items[0].sell_in)
コード例 #45
0
ファイル: test_gilded_rose.py プロジェクト: ericgarig/misc
 def test_sulfuras(self):
     """Test condition."""
     items = [Item("Sulfuras, Hand of Ragnaros", 4, 80)]
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     self.assertEqual([4, 80], [items[0].sell_in, items[0].quality])
コード例 #46
0
ファイル: test_gilded_rose.py プロジェクト: ericgarig/misc
 def test_aged_brie_goes_up(self):
     """Test condition."""
     items = [Item("Aged Brie", 11, 10)]
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     self.assertEqual([10, 11], [items[0].sell_in, items[0].quality])
コード例 #47
0
ファイル: test_gilded_rose.py プロジェクト: ericgarig/misc
 def test_items_not_more_than_50(self):
     """Test condition."""
     items = [Item("Vest of Agility", 4, 60)]
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     self.assertEqual([3, 50], [items[0].sell_in, items[0].quality])
コード例 #48
0
    def test_update_quality_increases_quality_for_backstage_passes(self):
        gilded_rose = GildedRose([self.backstage_passes])

        gilded_rose.update_quality()

        self.assertEqual(2, self.backstage_passes.quality)
コード例 #49
0
ファイル: test_gilded_rose.py プロジェクト: anishpdalal/katas
 def test_conjure(self):
 	item = Item("Conjured", -2, 1)
 	gilded_rose = GildedRose(item)
 	gilded_rose.update_quality()
 	self.assertEqual(gilded_rose.item.quality, 0)
 	self.assertEqual(gilded_rose.item.sell_in, -3)
コード例 #50
0
 def test_quality_degretation(self):
     items = [Item("foo", sell_in=5, quality=20)]
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     self.assertEqual(19, items[0].quality)
コード例 #51
0
ファイル: test_gilded_rose.py プロジェクト: ericgarig/misc
 def test_passes_sub_5_days(self):
     """Test condition."""
     items = [Item("Backstage passes to a TAFKAL80ETC concert", 4, 10)]
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     self.assertEqual([3, 13], [items[0].sell_in, items[0].quality])
コード例 #52
0
 def test_sulfuras_quality(self):
     items = [Item("Sulfuras, Hand of Ragnaros", sell_in=0, quality=80)]
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     self.assertEqual(80, items[0].quality)
コード例 #53
0
ファイル: test_gilded_rose.py プロジェクト: ericgarig/misc
 def test_passes_brie_goes_up(self):
     """Test condition."""
     items = [Item("Backstage passes to a TAFKAL80ETC concert", 11, 10)]
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     self.assertEqual([10, 11], [items[0].sell_in, items[0].quality])
コード例 #54
0
 def test_quality_max(self):
     items = [Item("Aged Brie", sell_in=2, quality=50)]
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     self.assertTrue(items[0].quality <= 50)
コード例 #55
0
    def test_update_quality_increases_quality_for_aged_brie(self):
        gilded_rose = GildedRose([self.aged_brie])

        gilded_rose.update_quality()

        self.assertEqual(2, self.aged_brie.quality)
コード例 #56
0
    def test_quality_is_never_less_than_zero(self):
        items = [Item("foo", 0, 0)]
        gilded_rose = GildedRose(items)
        gilded_rose.update_quality()

        self.assertEqual(0, gilded_rose.items[0].quality)
コード例 #57
0
 def test_conjured_sell_in(self):
     items = [Item("Conjured Mana Cake", 10, 20)]
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     self.assertEquals(9, items[0].sell_in)
コード例 #58
0
 def test_brie_expired(self):
     items = [Item("Aged Brie", 0, 0)]
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     self.assertEquals(2, items[0].quality)
コード例 #59
0
 def test_concert_under_10(self):
     items = [Item("Backstage passes to a TAFKAL80ETC concert", 8, 30)]
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     self.assertEquals(32, items[0].quality)
コード例 #60
0
 def test_backstage_passes_decrease_to_zero_after_concert(self):
     items = [Item("Backstage passes to a TAFKAL80ETC concert", 0, 10)]
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     self.assertEqual(0, gilded_rose.items[0].quality)