Exemplo n.º 1
0
 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]
Exemplo n.º 2
0
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
Exemplo n.º 3
0
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
Exemplo n.º 4
0
    def check_draw_bad(gem_str): assert not Bank.check_draw(gem_str)

    for entry in good:
Exemplo n.º 5
0
 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)
Exemplo n.º 6
0
def test_bank_draw1_wild():
    B = Bank('A')
    B.take('A')
    assert B.gems['A'] == 0
Exemplo n.º 7
0
def test_bank_draw3():
    B = Bank('rgb')
    B.take('rgb')
    assert sum(B.gems.values()) == 0
Exemplo n.º 8
0
def test_bank_draw2():
    B = Bank('aaaaa')
    B.take('aa')
    assert B.gems['a'] == 3
Exemplo n.º 9
0
 def check_draw_good(gem_str):
     assert Bank.check_draw(gem_str)
Exemplo n.º 10
0
def test_bank_draw1_notwild():
    B = Bank('Ab')
Exemplo n.º 11
0
def test_bank_draw1_wild():
    B = Bank('A')
    B.take('A')
    assert B.gems['A'] == 0
Exemplo n.º 12
0
def test_bank_draw3():
    B = Bank('rgb')
    B.take('rgb')
    assert sum(B.gems.values()) == 0
Exemplo n.º 13
0
def test_bank_draw2():
    B = Bank('aaaaa')
    B.take('aa')
    assert B.gems['a'] == 3
Exemplo n.º 14
0
 def check_draw_bad(gem_str):
     assert not Bank.check_draw(gem_str)