Exemplo n.º 1
0
 def test_full_house(self):
     cards = [self.get_card(suit, value) for suit, value in [['s', 12], ['s', 13], ['h', 12], ['h', 13], ['s', 6]]]
     g = Game(cards, blinds=3)
     player_hand = [self.get_card(suit, value) for suit, value in [['c', 12], ['s', 2]]]
     player = Hand(player_hand)
     play, hand_rank = player.play(g)
     self.assertEqual(hand_rank, 6)
Exemplo n.º 2
0
 def test_royal_flush(self):
     cards = [self.get_card(suit, value) for suit, value in [['s', 12], ['s', 13], ['s', 11], ['s', 10], ['s', 14]]]
     g = Game(cards, blinds=3)
     player_hand = [self.get_card(suit, value) for suit, value in [['c', 12], ['s', 2]]]
     player = Hand(player_hand)
     play, hand_rank = player.play(g)
     self.assertEqual(hand_rank, 9)
Exemplo n.º 3
0
 def test_flush(self):
     cards = [self.get_card(suit, value) for suit, value in [["s", 12], ["s", 13], ["h", 4], ["h", 11], ["s", 6]]]
     g = Game(cards, blinds=3)
     player_hand = [self.get_card(suit, value) for suit, value in [["s", 7], ["s", 2]]]
     player = Hand(player_hand)
     play, hand_rank = player.play(g)
     self.assertEqual(hand_rank, 5)
Exemplo n.º 4
0
 def test_four_of_kind(self):
     cards = copy.deepcopy(self.cards)
     cards[0] = self.get_card('c', 11)
     g = Game(cards, blinds=3)
     player_hand = [self.get_card(suit, value) for suit, value in [['s', 11], ['d', 11],]]
     player = Hand(player_hand)
     play, hand_rank = player.play(g)
     self.assertEqual(hand_rank, 7)
Exemplo n.º 5
0
 def test_four_of_kind(self):
     cards = copy.deepcopy(self.cards)
     cards[0] = self.get_card("c", 11)
     g = Game(cards, blinds=3)
     player_hand = [self.get_card(suit, value) for suit, value in [["s", 11], ["d", 11]]]
     player = Hand(player_hand)
     play, hand_rank = player.play(g)
     self.assertEqual(hand_rank, 7)
Exemplo n.º 6
0
    def test_straight(self):
        # test that straight works when straigh in the beginning
        cards = [self.get_card(suit, value) for suit, value in [["s", 2], ["s", 3], ["h", 4], ["h", 5], ["c", 6]]]
        g = Game(cards, blinds=3)
        player_hand = [self.get_card(suit, value) for suit, value in [["s", 11], ["d", 11]]]
        player = Hand(player_hand)
        play, hand_rank = player.play(g)
        self.assertEqual(hand_rank, 4)

        # now in the middle
        cards = [self.get_card(suit, value) for suit, value in [["s", 12], ["s", 3], ["h", 4], ["h", 5], ["c", 6]]]
        g = Game(cards, blinds=3)
        player_hand = [self.get_card(suit, value) for suit, value in [["s", 7], ["d", 11]]]
        player = Hand(player_hand)
        play, hand_rank = player.play(g)
        self.assertEqual(hand_rank, 4)

        # now in the end
        cards = [self.get_card(suit, value) for suit, value in [["s", 12], ["s", 13], ["h", 4], ["h", 5], ["c", 6]]]
        g = Game(cards, blinds=3)
        player_hand = [self.get_card(suit, value) for suit, value in [["s", 7], ["d", 8]]]
        player = Hand(player_hand)
        play, hand_rank = player.play(g)
        self.assertEqual(hand_rank, 4)

        # now mixed
        cards = [self.get_card(suit, value) for suit, value in [["s", 4], ["s", 13], ["h", 7], ["h", 6], ["c", 5]]]
        g = Game(cards, blinds=3)
        player_hand = [self.get_card(suit, value) for suit, value in [["s", 7], ["d", 8]]]
        player = Hand(player_hand)
        play, hand_rank = player.play(g)
        self.assertEqual(hand_rank, 4)
Exemplo n.º 7
0
    def test_straight(self):
        # test that straight works when straigh in the beginning
        cards = [self.get_card(suit, value) for suit, value in [['s', 2], ['s', 3], ['h', 4], ['h', 5], ['c', 6]]]
        g = Game(cards, blinds=3)
        player_hand = [self.get_card(suit, value) for suit, value in [['s', 11], ['d', 11],]]
        player = Hand(player_hand)
        play, hand_rank = player.play(g)
        self.assertEqual(hand_rank, 4)

        # now in the middle
        cards = [self.get_card(suit, value) for suit, value in [['s', 12], ['s', 3], ['h', 4], ['h', 5], ['c', 6]]]
        g = Game(cards, blinds=3)
        player_hand = [self.get_card(suit, value) for suit, value in [['s', 7], ['d', 11],]]
        player = Hand(player_hand)
        play, hand_rank = player.play(g)
        self.assertEqual(hand_rank, 4)

        # now in the end
        cards = [self.get_card(suit, value) for suit, value in [['s', 12], ['s', 13], ['h', 4], ['h', 5], ['c', 6]]]
        g = Game(cards, blinds=3)
        player_hand = [self.get_card(suit, value) for suit, value in [['s', 7], ['d', 8],]]
        player = Hand(player_hand)
        play, hand_rank = player.play(g)
        self.assertEqual(hand_rank, 4)

        # now mixed
        cards = [self.get_card(suit, value) for suit, value in [['s', 4], ['s', 13], ['h', 7], ['h', 6], ['c', 5]]]
        g = Game(cards, blinds=3)
        player_hand = [self.get_card(suit, value) for suit, value in [['s', 7], ['d', 8],]]
        player = Hand(player_hand)
        play, hand_rank = player.play(g)
        self.assertEqual(hand_rank, 4)
Exemplo n.º 8
0
 def test_three_of_kind(self):
     g = Game(self.cards, blinds=3)
     player_hand = [self.get_card(suit, value) for suit, value in [['s', 11], ['d', 11],]]
     player = Hand(player_hand)
     play, hand_rank = player.play(g)
     self.assertEqual(hand_rank, 3)
Exemplo n.º 9
0
 def test_three_of_kind(self):
     g = Game(self.cards, blinds=3)
     player_hand = [self.get_card(suit, value) for suit, value in [["s", 11], ["d", 11]]]
     player = Hand(player_hand)
     play, hand_rank = player.play(g)
     self.assertEqual(hand_rank, 3)