Пример #1
0
 def test_q7(self):
     q7deck = Deck()
     q7 = q7deck.deal_card()
     q7deck.replace_card(q7)
     self.assertEqual(len(q7deck.cards), 52)
     return len(q7deck.cards), 52
     '''
Пример #2
0
    def test_q8(self):
        '''
        1. fill in your test method for question 8:
        Test that if you invoke the replace_card method with a card that is already in the deck, the deck size is not affected.(The function must silently ignore it if you try to add a card that’s already in the deck)

        
        2. remove the pass command
        
        3. uncomment the return command and 
        3b. change X, Y to the values from your assert statement
        ### please note: normally unit test methods do not have return statements. But returning will allow for unit testing of your unit test, and allow you to check your answer with the autograder.  This is optional today.

        '''
        c1 = Card(0, 2)
        d1 = Deck()
        d1.replace_card(c1)
        self.assertEqual(len(d1.cards), 52)
        return len(d1.cards), 52  
Пример #3
0
    def test_q7(self):
        '''
        1. fill in your test method for question 7:
        Test that if you invoke the replace_card method, the deck has one more card in it afterwards. (Please note that you want to use deal_card function first to remove a card from the deck and then add the same card back in)

        
        2. remove the pass command
        
        3. uncomment the return command and 
        3b. change X, Y to the values from your assert statement
        ### please note: normally unit test methods do not have return statements. But returning will allow for unit testing of your unit test, and allow you to check your answer with the autograder.  This is optional today.

        '''
        d1 = Deck()
        Original_d1 = d1
        Removed_card = d1.deal_card()
        d1.replace_card(Removed_card)
        self.assertEqual(len(d1.cards), 52)
        return len(d1.cards), len(Original_d1.cards), 52