Example #1
0
 def test_joker(self):
     P = card.Plain
     JB = card.Joker.black
     JR = card.Joker.red
     c, d, h, s = list(card.Suit)
     assert card.decide([P(1, c), JB, JR], c) == JB
     assert card.decide([P(1, c), JB, JR], d) == JR
Example #2
0
    def test_same_two(self):
        P = card.Plain
        c, d, h, s = list(card.Suit)
        assert card.decide([P(2, c), P(3, c), P(10, c)], c) == P(2, c)

        # no same two occurs
        assert card.decide([P(2, c), P(3, c), c.right_jack], c) == c.right_jack
        assert card.decide([P(2, c), P(3, c), P(10, c)], c, is_first_round=True) == P(10, c)
Example #3
0
 def test_trump(self):
     # a trump wins if there are other cards which is not a trump
     P = card.Plain
     c, d, h, s = list(card.Suit)
     assert card.decide([P(1, c), P(3, c), P(10, c)], c) == P(1, c)
     assert card.decide([P(1, d), P(3, c), P(10, d)], c) == P(3, c)
     assert card.decide([P(1, d), P(3, h), P(10, s)], c) == P(10, s)  # lead won
     assert card.decide([P(1, s), P(3, c), P(10, d)], c) == P(1, s)  # ALMIGHTY won
Example #4
0
 def test_ace(self):
     # ace wins if there are only plain cards
     P = card.Plain
     c, d, h, s = list(card.Suit)
     assert card.decide([P(1, d), P(3, d), P(10, d)], c) == P(1, d)
     assert card.decide([P(1, d), P(3, d), P(10, d)], d) == P(1, d)
     assert card.decide([P(1, d), P(3, d), P(10, d)], h) == P(1, d)
     assert card.decide([P(1, d), P(3, d), P(10, d)], s) == P(1, d)
Example #5
0
 def test_yoromeki(self):
     P = card.Plain
     c, d, h, s = list(card.Suit)
     assert card.decide([P(1, s), P(12, h), P(10, c)], c) == P(12, h)
     assert card.decide([P(1, s), P(12, d), P(10, c)], c) == P(1, s)