def setup(self): self.P = Player('joe') self.P.wallet.put('rgb') self.B = Bank('rrrrggA') lands = [ dict(id=ii, cost='r' * ii, type='B', pv=ii) for ii in range(1, 6) ] lands.reverse() deck = LandDeck(1, 4, lands=lands) deck.deal() self.decks = [deck]
def test_check_neg(): B = Bank(gems={'r': 0, 'g': 2, 'b': 1, 'w': 1}) good = ['gbw', 'gg', 'ggbw'] bad = ['r', 'rg', 'ggg'] def B_check_neg_good(gem_str): assert not B.check_neg(gem_str) def B_check_neg_bad(gem_str): assert B.check_neg(gem_str) for entry in good: yield B_check_neg_good, entry for entry in bad: yield B_check_neg_bad, entry
def test_draw2_rule(): B = Bank(gems={'r': 5, 'g': 4, 'b': 3, 'w': 2, 'd': 1}) good = ['rr', 'gg', 'r', 'g', 'rgb', 'bwd'] # should return options here bad = ['bb', 'ww', 'dd', 'b', 'w', 'd'] # take into account case where no draw2 options and, say, rgb is given? def check_can_draw2_good(gem_str): assert B.check_can_draw2(gem_str) def check_can_draw2_bad(gem_str): assert not B.check_can_draw2(gem_str) for entry in good: yield check_can_draw2_good, entry for entry in bad: yield check_can_draw2_bad, entry
def check_draw_bad(gem_str): assert not Bank.check_draw(gem_str) for entry in good:
def check_draw_good(gem_str): assert Bank.check_draw(gem_str) def check_draw_bad(gem_str): assert not Bank.check_draw(gem_str)
def test_bank_draw1_wild(): B = Bank('A') B.take('A') assert B.gems['A'] == 0
def test_bank_draw3(): B = Bank('rgb') B.take('rgb') assert sum(B.gems.values()) == 0
def test_bank_draw2(): B = Bank('aaaaa') B.take('aa') assert B.gems['a'] == 3
def check_draw_good(gem_str): assert Bank.check_draw(gem_str)
def test_bank_draw1_notwild(): B = Bank('Ab')
def check_draw_bad(gem_str): assert not Bank.check_draw(gem_str)