Beispiel #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
Beispiel #2
0
def deck_card_count_test():
    '''Testing create deck function, that it creates a 52 card deck'''
    d = Deck()
    if d.card_count() == 52:
        return True
    else:
        return False
Beispiel #3
0
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
Beispiel #4
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
Beispiel #5
0
def deck_remove_top_card_test():
    d = Deck()
    print('------: ' + 'Create Deck')
    print(Fore.CYAN + 'OUTPUT: ', end='')
    print(Style.RESET_ALL, end='')
    deck_iter(d)
    d.remove_top_card()
    print('------: ' + 'Removing Top Card')
    print(Fore.CYAN + 'OUTPUT: ', end='')
    print(Style.RESET_ALL, end='')
    deck_iter(d)
    if d.card_count() == 51:
        return True
    else:
        return False
Beispiel #6
0
def deck_shuffle_test():
    '''
    Testing whether shuffle deck function works, by testing it against
    an unshuffled deck
    '''
    a = Deck()
    b = Deck()
    b.shuffle_deck()
    same_spot = 0
    print('------: ' + 'Shuffling Deck')
    print(Fore.CYAN + 'OUTPUT: ', end='')
    print(Style.RESET_ALL, end='')
    deck_iter(b)
    for i in range(a.card_count()):
        if a.cards[i] == b.cards[i]:
            same_spot += 1
    if same_spot == 52:
        return False
    elif same_spot <= 10:
        return True