def test_trips(self): simulator = PokerSimulator([['Th', '9d']], ['Ad', 'Kh', 'Qs', 'Tc', 'Td']) board = simulator.board_state + simulator.player_hands[0] hand_strength = simulator.get_hand_strength(board) self.assertEqual(hand_strength, (StrengthIndex.THREE_OF_A_KIND.value, 10, 27))
def test_straight_flush_multiple(self): simulator = PokerSimulator([['8d', '9d']], ['Td', '2d', 'Jd', 'Qd', 'Kd']) board = simulator.board_state + simulator.player_hands[0] hand_strength = simulator.get_hand_strength(board) self.assertEqual(hand_strength, (StrengthIndex.STRAIGHT_FLUSH.value, 13))
def test_two_pair_multiple(self): simulator = PokerSimulator([['Th', '9d']], ['Ad', 'Kh', 'As', 'Kc', 'Td']) board = simulator.board_state + simulator.player_hands[0] hand_strength = simulator.get_hand_strength(board) self.assertEqual(hand_strength, (StrengthIndex.TWO_PAIR.value, 14, 13, 10))
def test_straight_flush_a_to_5(self): simulator = PokerSimulator([['Ad', 'Kd']], ['Ah', '2d', '3d', '5d', '4d']) board = simulator.board_state + simulator.player_hands[0] hand_strength = simulator.get_hand_strength(board) self.assertEqual(hand_strength, (StrengthIndex.STRAIGHT_FLUSH.value, 5))
def test_quads(self): simulator = PokerSimulator([['Ad', '2h']], ['Ah', '2d', 'As', 'Ac', 'Td']) board = simulator.board_state + simulator.player_hands[0] hand_strength = simulator.get_hand_strength(board) self.assertEqual(hand_strength, (StrengthIndex.FOUR_OF_A_KIND.value, 14, 10))
def test_full_house_multiple(self): simulator = PokerSimulator([['Ad', '2h']], ['Ah', '2d', 'As', 'Th', 'Td']) board = simulator.board_state + simulator.player_hands[0] hand_strength = simulator.get_hand_strength(board) self.assertEqual(hand_strength, (StrengthIndex.FULL_HOUSE.value, 14, 10))
def test_straight(self): simulator = PokerSimulator([['Th', '9d']], ['2d', 'Kh', 'Qs', 'Tc', 'Jd']) board = simulator.board_state + simulator.player_hands[0] hand_strength = simulator.get_hand_strength(board) board_rank_values = sorted( [simulator.rank_values[card[0]] for card in board]) self.assertEqual(hand_strength, (StrengthIndex.STRAIGHT.value, 13))
def test_flush(self): simulator = PokerSimulator([['Ah', '2h']], ['3d', '4h', '5s', 'Th', 'Jh']) board = simulator.board_state + simulator.player_hands[0] hand_strength = simulator.get_hand_strength(board) self.assertEqual(hand_strength, (StrengthIndex.FLUSH.value, 15.4))
def test_straight_ace_to_5(self): simulator = PokerSimulator([['Ah', '2d']], ['3d', '4h', '5s', 'Tc', 'Jd']) board = simulator.board_state + simulator.player_hands[0] hand_strength = simulator.get_hand_strength(board) self.assertEqual(hand_strength, (StrengthIndex.STRAIGHT.value, 5))
def test_straight_multiple(self): simulator = PokerSimulator([['Th', '9d']], ['Ad', 'Kh', 'Qs', 'Tc', 'Jd']) board = simulator.board_state + simulator.player_hands[0] hand_strength = simulator.get_hand_strength(board) self.assertEqual(hand_strength, (StrengthIndex.STRAIGHT.value, 14))
def test_one_pair(self): simulator = PokerSimulator([['Ah', 'Kd']], ['Ad', '3h', '7s', '9c', 'Td']) board = simulator.board_state + simulator.player_hands[0] hand_strength = simulator.get_hand_strength(board) self.assertEqual(hand_strength, (StrengthIndex.ONE_PAIR.value, 14, 32))
def test_high_card(self): simulator = PokerSimulator([['Ah', 'Kd']], ['2d', '3h', '7s', '9c', 'Td']) board = simulator.board_state + simulator.player_hands[0] hand_strength = simulator.get_hand_strength(board) self.assertEqual(hand_strength, (StrengthIndex.HIGH_CARD.value, 53))