Exemple #1
0
 def test_best_score_no_ace(self):
     """
     Tests whether the correct best score is returned, excluding aces.
     """
     h = Hand()
     card = Card('king', [10])
     h.add_card(card)
     self.assertEqual(h.get_best_score(), 10)
     h.add_card(card)
     self.assertEqual(h.get_best_score(), 20)
     h.add_card(card)
     self.assertEqual(h.get_best_score(), 30)
Exemple #2
0
 def test_best_score_w_ace(self):
     """
     Tests whether the correct best score is returned, including aces.
     """
     h = Hand()
     card1 = Card('ace', [1, 11])
     card2 = Card('king', [10])
     h.add_card(card1)
     self.assertEqual(h.get_best_score(), 11)
     h.add_card(card2)
     self.assertEqual(h.get_best_score(), 21)
     h.add_card(card2)
     self.assertEqual(h.get_best_score(), 21)
     h.add_card(card2)
     self.assertEqual(h.get_best_score(), 31)