def deck_reset_deck_test(): ''' Reverse the dealing_test(). Deals out the hands, then tests reset functions, making sure the deck resets back to a 52 card deck and hands back to 0 ''' d = Deck() h1 = Hand() h2 = Hand() for i in range(7): d.deal_to_hand(h1) d.deal_to_hand(h2) if d.card_count() == 38: d.reset_deck() if h1.card_count() == 7 and h2.card_count() == 7: for i in range(h1.card_count()): h1.remove_card1() h2.remove_card1() if h1.is_empty() and h2.is_empty(): return True else: print('NOT EMPTY') return False else: print('Doesn\'t have 7 cards') return False else: print('Doesn\'t have 38 cards') return False
def hand_remove_card1_test(): c = Card('A', 'd') h = Hand() h.add_card(c) if h.card_count() == 1: h.remove_card1() if h.card_count() == 0: return True else: return False else: return False
def deck_deal_to_hand_test(): ''' Testing card dealing by dealing 7 cards to 2 separate Hands and checking the count of both the cards and hands are correct ''' d = Deck() h1 = Hand() h2 = Hand() for i in range(7): d.deal_to_hand(h1) d.deal_to_hand(h2) if d.card_count() == 38: if h1.card_count() == 7 and h2.card_count() == 7: return True
def hand_card_count_test(): d = Deck() h = Hand() d.deal_cards(h, 8) if h.card_count() == 8: return True else: return False
def deck_deal_cards_test(): d = Deck() h = Hand() d.deal_cards(h, 10) if d.card_count() == 42 and h.card_count() == 10: return True else: return False
def hand_add_card_test(): c = Card('A', 'd') h = Hand() h.add_card(c) if h.card_count() == 1: if h.cards[0].rank == 'A' and h.cards[0].suit == 'd': return True else: return False else: return False