From 671461d44098fe657032de2acc2a27e61035a690 Mon Sep 17 00:00:00 2001 From: zoengsw Date: Mon, 10 Nov 2025 15:24:15 +0000 Subject: [PATCH] refactor: add switch cases --- python/tests/gilded_rose.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/python/tests/gilded_rose.py b/python/tests/gilded_rose.py index 4f21ea64..9cd20bb5 100644 --- a/python/tests/gilded_rose.py +++ b/python/tests/gilded_rose.py @@ -1,12 +1,25 @@ # -*- coding: utf-8 -*- class GildedRose(object): + BACKSTAGE = 'Backstage passes to a TAFKAL80ETC concert' + SULFURAS = 'Sulfuras, Hand of Ragnaros' + AGED_BRIE = 'Aged Brie' def __init__(self, items): self.items = items def update_quality(self): for item in self.items: + + match item.name: + case self.AGED_BRIE: + pass + case self.SULFURAS: + pass + case self.BACKSTAGE: + pass + case _: + pass if item.name != "Aged Brie" and item.name != "Backstage passes to a TAFKAL80ETC concert": if item.quality > 0: if item.name != "Sulfuras, Hand of Ragnaros":