Created
August 23, 2018 07:56
-
-
Save emilybache/85fc473e008f8ceec38e0ef616fe2312 to your computer and use it in GitHub Desktop.
issue #386 in cosmic ray - the files needed to reproduce the problem
This file contains hidden or 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
module: gilded_rose | |
baseline: 10 | |
exclude-modules: | |
test-runner: | |
name: unittest | |
args: test_gilded_rose | |
execution-engine: | |
name: local |
This file contains hidden or 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 -*- | |
class GildedRose(object): | |
def __init__(self, items): | |
self.items = items | |
def update_quality(self): | |
for item in self.items: | |
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": | |
item.quality = item.quality - 1 | |
else: | |
if item.quality < 50: | |
item.quality = item.quality + 1 | |
if item.name == "Backstage passes to a TAFKAL80ETC concert": | |
if item.sell_in < 11: | |
if item.quality < 50: | |
item.quality = item.quality + 1 | |
if item.sell_in < 6: | |
if item.quality < 50: | |
item.quality = item.quality + 1 | |
if item.name != "Sulfuras, Hand of Ragnaros": | |
item.sell_in = item.sell_in - 1 | |
if item.sell_in < 0: | |
if item.name != "Aged Brie": | |
if item.name != "Backstage passes to a TAFKAL80ETC concert": | |
if item.quality > 0: | |
if item.name != "Sulfuras, Hand of Ragnaros": | |
item.quality = item.quality - 1 | |
else: | |
item.quality = item.quality - item.quality | |
else: | |
if item.quality < 50: | |
item.quality = item.quality + 1 | |
class Item: | |
def __init__(self, name, sell_in, quality): | |
self.name = name | |
self.sell_in = sell_in | |
self.quality = quality | |
def __repr__(self): | |
return "%s, %s, %s" % (self.name, self.sell_in, self.quality) |
This file contains hidden or 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
args: ('foo', -1, 0) => 'foo, -2, 0' | |
args: ('foo', -1, 1) => 'foo, -2, 0' | |
args: ('foo', -1, 49) => 'foo, -2, 47' | |
args: ('foo', -1, 50) => 'foo, -2, 48' | |
args: ('foo', 0, 0) => 'foo, -1, 0' | |
args: ('foo', 0, 1) => 'foo, -1, 0' | |
args: ('foo', 0, 49) => 'foo, -1, 47' | |
args: ('foo', 0, 50) => 'foo, -1, 48' | |
args: ('foo', 11, 0) => 'foo, 10, 0' | |
args: ('foo', 11, 1) => 'foo, 10, 0' | |
args: ('foo', 11, 49) => 'foo, 10, 48' | |
args: ('foo', 11, 50) => 'foo, 10, 49' | |
args: ('Aged Brie', -1, 0) => 'Aged Brie, -2, 2' | |
args: ('Aged Brie', -1, 1) => 'Aged Brie, -2, 3' | |
args: ('Aged Brie', -1, 49) => 'Aged Brie, -2, 50' | |
args: ('Aged Brie', -1, 50) => 'Aged Brie, -2, 50' | |
args: ('Aged Brie', 0, 0) => 'Aged Brie, -1, 2' | |
args: ('Aged Brie', 0, 1) => 'Aged Brie, -1, 3' | |
args: ('Aged Brie', 0, 49) => 'Aged Brie, -1, 50' | |
args: ('Aged Brie', 0, 50) => 'Aged Brie, -1, 50' | |
args: ('Aged Brie', 11, 0) => 'Aged Brie, 10, 1' | |
args: ('Aged Brie', 11, 1) => 'Aged Brie, 10, 2' | |
args: ('Aged Brie', 11, 49) => 'Aged Brie, 10, 50' | |
args: ('Aged Brie', 11, 50) => 'Aged Brie, 10, 50' | |
args: ('Sulfuras, Hand of Ragnaros', -1, 0) => 'Sulfuras, Hand of Ragnaros, -1, 0' | |
args: ('Sulfuras, Hand of Ragnaros', -1, 1) => 'Sulfuras, Hand of Ragnaros, -1, 1' | |
args: ('Sulfuras, Hand of Ragnaros', -1, 49) => 'Sulfuras, Hand of Ragnaros, -1, 49' | |
args: ('Sulfuras, Hand of Ragnaros', -1, 50) => 'Sulfuras, Hand of Ragnaros, -1, 50' | |
args: ('Sulfuras, Hand of Ragnaros', 0, 0) => 'Sulfuras, Hand of Ragnaros, 0, 0' | |
args: ('Sulfuras, Hand of Ragnaros', 0, 1) => 'Sulfuras, Hand of Ragnaros, 0, 1' | |
args: ('Sulfuras, Hand of Ragnaros', 0, 49) => 'Sulfuras, Hand of Ragnaros, 0, 49' | |
args: ('Sulfuras, Hand of Ragnaros', 0, 50) => 'Sulfuras, Hand of Ragnaros, 0, 50' | |
args: ('Sulfuras, Hand of Ragnaros', 11, 0) => 'Sulfuras, Hand of Ragnaros, 11, 0' | |
args: ('Sulfuras, Hand of Ragnaros', 11, 1) => 'Sulfuras, Hand of Ragnaros, 11, 1' | |
args: ('Sulfuras, Hand of Ragnaros', 11, 49) => 'Sulfuras, Hand of Ragnaros, 11, 49' | |
args: ('Sulfuras, Hand of Ragnaros', 11, 50) => 'Sulfuras, Hand of Ragnaros, 11, 50' | |
args: ('Backstage passes to a TAFKAL80ETC concert', -1, 0) => 'Backstage passes to a TAFKAL80ETC concert, -2, 0' | |
args: ('Backstage passes to a TAFKAL80ETC concert', -1, 1) => 'Backstage passes to a TAFKAL80ETC concert, -2, 0' | |
args: ('Backstage passes to a TAFKAL80ETC concert', -1, 49) => 'Backstage passes to a TAFKAL80ETC concert, -2, 0' | |
args: ('Backstage passes to a TAFKAL80ETC concert', -1, 50) => 'Backstage passes to a TAFKAL80ETC concert, -2, 0' | |
args: ('Backstage passes to a TAFKAL80ETC concert', 0, 0) => 'Backstage passes to a TAFKAL80ETC concert, -1, 0' | |
args: ('Backstage passes to a TAFKAL80ETC concert', 0, 1) => 'Backstage passes to a TAFKAL80ETC concert, -1, 0' | |
args: ('Backstage passes to a TAFKAL80ETC concert', 0, 49) => 'Backstage passes to a TAFKAL80ETC concert, -1, 0' | |
args: ('Backstage passes to a TAFKAL80ETC concert', 0, 50) => 'Backstage passes to a TAFKAL80ETC concert, -1, 0' | |
args: ('Backstage passes to a TAFKAL80ETC concert', 11, 0) => 'Backstage passes to a TAFKAL80ETC concert, 10, 1' | |
args: ('Backstage passes to a TAFKAL80ETC concert', 11, 1) => 'Backstage passes to a TAFKAL80ETC concert, 10, 2' | |
args: ('Backstage passes to a TAFKAL80ETC concert', 11, 49) => 'Backstage passes to a TAFKAL80ETC concert, 10, 50' | |
args: ('Backstage passes to a TAFKAL80ETC concert', 11, 50) => 'Backstage passes to a TAFKAL80ETC concert, 10, 50' |
This file contains hidden or 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 verify_all_combinations | |
from gilded_rose import Item, GildedRose | |
from approvaltests.reporters.generic_diff_reporter_factory import GenericDiffReporter | |
class GildedRoseTest(unittest.TestCase): | |
def test_foo(self): | |
verify_all_combinations(self.do_update, ( | |
["foo", | |
"Aged Brie", | |
"Sulfuras, Hand of Ragnaros", | |
"Backstage passes to a TAFKAL80ETC concert"], | |
[-1, 0, 11], | |
[0, 1, 49, 50], | |
), reporter=GenericDiffReporter(('Custom', '/usr/bin/diff'))) | |
def do_update(self, name, sell_in, quality): | |
items = [Item(name, sell_in, quality)] | |
gilded_rose = GildedRose(items) | |
gilded_rose.update_quality() | |
item_repr = repr(items[0]) | |
return item_repr | |
if __name__ == '__main__': | |
unittest.main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment