Exemplo n.º 1
0
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
Exemplo n.º 2
0
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