def test_straight_flush(self): rank_desc = 'straight flush' r_rank_name, r_ranking_num = hand_rank( self.hands.get('straight_flush')) #tests self.assertEqual(r_rank_name, rank_desc) self.assertEqual(r_ranking_num, RANKING.get(rank_desc))
def _display(self, player, playertype='p'): ''' Prints out the stats Example Output: Your Hand: 1: (2, 'Diamonds') 2: (2, 'Spades') 3: (5, 'Spades') 4: ('King', 'Spades') 5: ('Ace', 'Spades') You have: pair Stack Size: 200 ''' PLAYER_HAND = 'Your Hand:' CPU_HAND = 'CPU Hand:' PLAYER_RESULT = 'You have:' CPU_RESULT = 'CPU has:' # hand details _hand_msg = CPU_HAND if playertype == 'c' else PLAYER_HAND print(f'{_hand_msg}', end='\n') player.print_hand() # get the ranking of the hand _rank = hand_rank(player.hand) _result, _ = _rank _result_msg = CPU_RESULT if playertype == 'c' else PLAYER_RESULT print(f'{_result_msg} {_result}') # get stack size print(f'Stack Size: {player.stack}') # dealer status if self.player.isDealer and playertype == 'p': print('You are dealer.') elif self.cpu.isDealer: print('CPU is dealer.') print(f'Pot: {self.pot_size}\n')
def test_quads(self): rank_desc = 'quads' r_rank_name, r_ranking_num = hand_rank(self.hands.get('quads')) #tests self.assertEqual(r_rank_name, rank_desc) self.assertEqual(r_ranking_num, RANKING.get(rank_desc))
def test_full_house(self): rank_desc = 'full house' r_rank_name, r_ranking_num = hand_rank(self.hands.get('full_house')) #tests self.assertEqual(r_rank_name, rank_desc) self.assertEqual(r_ranking_num, RANKING.get(rank_desc))
def test_two_pair(self): rank_desc = 'two pair' r_rank_name, r_ranking_num = hand_rank(self.hands.get('two_pair')) #tests self.assertEqual(r_rank_name, rank_desc) self.assertEqual(r_ranking_num, RANKING.get(rank_desc))
def test_high_card(self): rank_desc = 'high card' r_rank_name, r_ranking_num = hand_rank(self.hands.get('high_card')) #tests self.assertEqual(r_rank_name, rank_desc) self.assertEqual(r_ranking_num, RANKING.get(rank_desc))