def test_combined_case(self):
        items = [
            gilded_rose.Item(name='+5 Dexterity Vest', sell_in=10, quality=20),
            gilded_rose.Item(name=gilded_rose.AGED_BRIE, sell_in=2, quality=gilded_rose.MIN_QUALITY),
            gilded_rose.Item(name='Elixir of the Mongoose', sell_in=5, quality=7),
            gilded_rose.Item(name=gilded_rose.SULFURAS, sell_in=0, quality=gilded_rose.LEGENDARY_QUALITY),
            gilded_rose.Item(name=gilded_rose.SULFURAS, sell_in=-1, quality=gilded_rose.LEGENDARY_QUALITY),
            gilded_rose.Item(name=gilded_rose.BACKSTAGE_PASS, sell_in=15, quality=20),
            gilded_rose.Item(name=gilded_rose.BACKSTAGE_PASS, sell_in=10, quality=49),
            gilded_rose.Item(name=gilded_rose.BACKSTAGE_PASS, sell_in=5, quality=49),
            gilded_rose.Item(name='Conjured Mana Cake', sell_in=3, quality=6),
        ]
        gilded_rose_instance = gilded_rose.GildedRose(items)

        gilded_rose_instance.update_quality()

        assert_that(gilded_rose_instance.items, contains_exactly(
            has_properties(sell_in=9, quality=19),
            has_properties(sell_in=1, quality=1),
            has_properties(sell_in=4, quality=6),
            has_properties(sell_in=0, quality=gilded_rose.LEGENDARY_QUALITY),
            has_properties(sell_in=-1, quality=gilded_rose.LEGENDARY_QUALITY),
            has_properties(sell_in=14, quality=21),
            has_properties(sell_in=9, quality=gilded_rose.MAX_QUALITY),
            has_properties(sell_in=4, quality=gilded_rose.MAX_QUALITY),
            has_properties(sell_in=2, quality=4),
        ))
    def test_initialization_with_invalid_quality(self):
        item = gilded_rose.Item(name=gilded_rose.SULFURAS, sell_in=0, quality=42)

        assert_that(item.quality, is_(equal_to(gilded_rose.LEGENDARY_QUALITY)))
    def test_item_update(self, sell_in, quality, expected_sell_in, expected_quality):
        item = gilded_rose.Item(name=gilded_rose.AGED_BRIE, sell_in=sell_in, quality=quality)

        item.update()

        assert_that(item, has_properties(sell_in=expected_sell_in, quality=expected_quality))
    def test_creating_instances_of_proper_subclasses(self, name, expected_class):
        item = gilded_rose.Item(name=name, sell_in=10, quality=20)

        assert_that(type(item), is_(equal_to(expected_class)))
    def test_item_update(self, sell_in, quality, expected_sell_in, expected_quality):
        item = gilded_rose.Item(name='Conjured Mana Cake', sell_in=sell_in, quality=quality)

        item.update()

        assert_that(item, has_properties(sell_in=expected_sell_in, quality=expected_quality))