def test_face_cards(self, hand1, hand2, comp_val): our_hand = BJHand() for c in hand1: our_hand.add_card(Card(c, 'H')) deal_hand = BJHand() for val in hand2: deal_hand.add_card(Card(val, 'S')) our_hand.stand() deal_hand.stand() assert our_hand.compare_to(deal_hand) == comp_val
def test_aces(self): ace = Card(1, "S") hand1 = BJHand() for _ in range(3): hand1.add_card(ace) hand1.stand() hand2 = BJHand() hand2.add_card(Card(10, "C")) for _ in range(2): hand2.add_card(ace) hand2.stand() assert hand1.compare_to(hand2) == 1
def test_blackjack(self): blackjack = BJHand() blackjack.hand_value = -1 dealer_hand = BJHand() dealer_hand.hand_value = 21 assert blackjack.compare_to(dealer_hand) == 1