Created
June 1, 2024 08:15
-
-
Save emilybache/93ff869d0946de862a6633d58dccd15f to your computer and use it in GitHub Desktop.
approvals and all combinations test in Python for Gilded Rose
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import unittest | |
from approvaltests import combination_approvals | |
from gilded_rose import Item, GildedRose | |
class GildedRoseTest(unittest.TestCase): | |
def test_update_quality(self): | |
combination_approvals.verify_all_combinations( | |
do_update_quality, | |
[ | |
["foo", "Aged Brie", "Backstage passes to a TAFKAL80ETC concert", "Sulfuras, Hand of Ragnaros"], | |
[-1, 0, 5, 6, 10, 11], # sell_in | |
[0, 1, 2, 49, 50] # quality | |
] | |
) | |
def do_update_quality(name, sell_in, quality): | |
items = [Item(name, sell_in, quality)] | |
gilded_rose = GildedRose(items) | |
gilded_rose.update_quality() | |
return item_printer(items[0]) | |
def item_printer(item): | |
return f"{item.name} sellIn: {item.sell_in} quality: {item.quality}" | |
if __name__ == '__main__': | |
unittest.main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment