Beispiel #1
0
    def test_getCardEnd(self):
        """Getting the next card should return None if no more cards are left""" 
        deck =  Deck(3)
        a = []

        for i in range(len(deck._Deck__deck)):
            card = deck.getCard()
            a.append(card)

        last_card = deck.getCard()
        last_card2 = deck.getCard()
        last_card3 = deck.getCard()
        last_card4 = deck.getCard()

        assert(last_card is None and last_card2 is None and 
                last_card3 is None and last_card4 is None)
        assert(deck.getCardIndex() == len(deck._Deck__deck))
        assert(deck.getCardIndex() == deck.getTotalCards())
Beispiel #2
0
    def test_getCard(self):
        """Getting the next card should produces cards in sequencial index order""" 
        deck = Deck(5)

        deck.shuffle()
        a = []

        for i in range(len(deck._Deck__deck)):
            card = deck.getCard()
            a.append(card)

        for i in range(len(deck._Deck__deck)):
            assert(a[i] == deck._Deck__deck[i])