Exemple #1
0
 def test_figures_out_flush_is_best_card(self):
     cards = [
         Card(rank=rank, suit="Hearts")
         for rank in ["2", "5", "10", "Queen", "King"]
     ]
     hand = Hand()
     hand.add_cards(cards)
     self.assertEqual(hand.best_rank(), "Flush")
Exemple #2
0
 def test_figures_out_four_of_a_kind_is_best_card(self):
     cards = [
         Card("Ace", "Diamonds"),
         Card("Ace", "Hearts"),
         Card("Ace", "Clubs"),
         Card("Ace", "Spades"),
         Card("King", "Diamonds")
     ]
     hand = Hand()
     hand.add_cards(cards)
     self.assertEqual(hand.best_rank(), "Four of a Kind")
Exemple #3
0
 def test_figures_out_full_house_is_best_card(self):
     cards = [
         Card("Ace", "Diamonds"),
         Card("Ace", "Hearts"),
         Card("Ace", "Clubs"),
         Card("King", "Spades"),
         Card("King", "Diamonds")
     ]
     hand = Hand()
     hand.add_cards(cards)
     self.assertEqual(hand.best_rank(), "Full House")
Exemple #4
0
 def test_figures_out_royal_flush_is_best_card(self):
     cards = [
         Card("10", "Diamonds"),
         Card("Jack", "Diamonds"),
         Card("Queen", "Diamonds"),
         Card("King", "Diamonds"),
         Card("Ace", "Diamonds")
     ]
     hand = Hand()
     hand.add_cards(cards)
     self.assertEqual(hand.best_rank(), "Royal Flush")
Exemple #5
0
 def test_figures_out_straight_flush_is_best_card(self):
     cards = [
         Card("6", "Diamonds"),
         Card("7", "Diamonds"),
         Card("8", "Diamonds"),
         Card("9", "Diamonds"),
         Card("10", "Diamonds")
     ]
     hand = Hand()
     hand.add_cards(cards)
     self.assertEqual(hand.best_rank(), "Straight Flush")
Exemple #6
0
    def test_figures_out_three_of_the_kind_is_best_card(self):
        cards = [
            Card("Ace", "Diamonds"),
            Card("Ace", "Clubs"),
            Card("Ace", "Diamonds"),
            Card("King", "Clubs"),
            Card("5", "Clubs"),
        ]

        hand = Hand()
        hand.add_cards(cards)
        self.assertEqual(hand.best_rank(), "Three of a Kind")
Exemple #7
0
    def test_figures_out_two_pairs_is_best_card(self):
        cards = [
            Card("Ace", "Diamonds"),
            Card("Ace", "Clubs"),
            Card("King", "Diamonds"),
            Card("King", "Clubs"),
            Card("5", "Clubs"),
        ]

        hand = Hand()
        hand.add_cards(cards)
        self.assertEqual(hand.best_rank(), "Two Pair")
Exemple #8
0
 def test_figures_out_pair_is_best_card(self):
     cards = [Card("Ace", "Diamonds"), Card("Ace", "Clubs")]
     hand = Hand()
     hand.add_cards(cards)
     self.assertEqual(hand.best_rank(), "Pair")
Exemple #9
0
 def test_figures_out_high_card_is_best_card(self):
     cards = [Card("Ace", "Diamonds"), Card("7", "Hearts")]
     hand = Hand()
     hand.add_cards(cards)
     self.assertEqual(hand.best_rank(), "High Card")
Exemple #10
0
 def test_figures_out_no_cards(self):
     hand = Hand()
     self.assertEqual(hand.best_rank(), "No Cards")