Ejemplo n.º 1
0
 def testdraw(self):
     deck = hw5.Deck()
     hand = ec1.Hand(deck.cards)
     deck1=hw5.Deck()
     hand.draw(deck1)
     self.assertEqual(len(hand.init_card),53)
     self.assertEqual(len(deck1.cards),51)
Ejemplo n.º 2
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.

        '''
        q7 = hw5_cards.Deck()
        q71 = hw5_cards.Deck(
        )  # create this to match the autograder expected output
        q7.deal_card(
        )  # deal_card() will remote the card from q7, and return the removed card (3,13)
        q71.deal_card(
        )  # q71 is used to test after deal function, the length of q71 should be 51 not 52
        q7.replace_card(
            hw5_cards.Card(3, 13)
        )  # use hw5_cards.Card(3,13) to add back the one being pop out which is King of Spades (3,13)
        self.assertEqual(
            len(q7.cards), 52
        )  #q7 is the list after pop function and replace function >> length should be 52
        self.assertNotEqual(
            len(q7.cards), 53
        )  #q7 is the list after pop function and replace function >> length should be 52
        return len(q71.cards) + 1, len(
            q7.cards
        ), 52  # q71 is used to test the length after deal, q7 is the length after deal and replace
Ejemplo n.º 3
0
    def test_q4(self):
        '''
        1. fill in your test method for question 4:
        Test that if you create a eck instance, it will have 52 cards in its cards instance variable
        
        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.

        '''
        self.assertEqual(len(hw5_cards.Deck().cards),52)
        return len(hw5_cards.Deck().cards),52
Ejemplo n.º 4
0
    def test_q5(self):
        '''
        1. fill in your test method for question 5:
        Test that if you invoke the deal_card method on a deck, it will return a card instance.
        
        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.

        '''
        self.assertIsInstance(hw5_cards.Deck().deal_card(),hw5_cards.Card)
        return hw5_cards.Deck().deal_card(),hw5_cards.Card
Ejemplo n.º 5
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.

        '''
        c_test_q7_1 = hw5_cards.Deck()
        self.assertEqual(len(c_test_q7_1.cards), 52)
        card0 = c_test_q7_1.deal_card()
        self.assertEqual(len(c_test_q7_1.cards), 51)
        X = len(c_test_q7_1.cards) + 1
        c_test_q7_1.replace_card(card0)
        self.assertEqual(len(c_test_q7_1.cards), 52)
        Y = len(c_test_q7_1.cards)
        Z = 52
        card1 = c_test_q7_1.deal_card()
        card2 = c_test_q7_1.deal_card()
        self.assertEqual(len(c_test_q7_1.cards), 50)
        c_test_q7_1.replace_card(card1)
        c_test_q7_1.replace_card(card2)
        self.assertEqual(len(c_test_q7_1.cards), 52)
        return X, Y, Z
Ejemplo n.º 6
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.

        '''
        q8 = hw5_cards.Deck()
        randomNumber = random.randint(1,len(q8.cards))
        new_card = q8.cards[randomNumber]
        temp = q8.cards.copy()
        q8.replace_card(new_card)
        #print("pop cards : " + str(new_card))
        #print("pre cards : " + str(len(temp)))
        #print("now cards : " + str(len(q8.cards)))
        
        self.assertEqual(len(q8.cards), len(temp))
        
        return len(q8.cards), len(temp)
Ejemplo n.º 7
0
    def test_q6(self):
        '''
        1. fill in your test method for question 6:
        
        Test that if you invoke the deal_card method on a deck, the deck has one fewer cards in it afterwards.
        
        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.

        '''
        q6 = hw5_cards.Deck()
        q6_cards = q6.cards.copy() #list可以算len
        q6.deal_card()
        nq6_cards = q6.cards
        
        self.assertEqual(len(q6_cards)-1,len(nq6_cards))
        self.assertNotEqual(len(q6_cards), len(nq6_cards))
        self.assertTrue(len(q6_cards) != len(nq6_cards))
        self.assertFalse(len(q6_cards) == len(nq6_cards))
        self.assertEqual(len(q6_cards)-1 , len(nq6_cards))
        self.assertNotEqual(len(q6_cards), len(nq6_cards))
        
        return len(q6_cards)-1, len(nq6_cards)   
Ejemplo n.º 8
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.

        '''
        test_deck = hw5_cards.Deck()

        num_card1 = len(test_deck.cards)
        test_card = hw5_cards.Card(suit=3, rank=13)

        test_deck.replace_card(test_card)
        num_card2 = len(test_deck.cards)

        X = num_card2 - num_card1
        Y = 0
        self.assertEqual(X, Y)

        return X, Y
Ejemplo n.º 9
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.

        '''
        test_deck = hw5_cards.Deck()

        tmp_card = test_deck.deal_card()
        card_num1 = len(test_deck.cards)

        test_deck.replace_card(tmp_card)
        card_num2 = len(test_deck.cards)

        X = card_num2 - card_num1
        Y = 1
        self.assertEqual(X, Y)

        return X, Y
Ejemplo n.º 10
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.

        '''
        suit = random.randint(0, 3)
        rank = random.randint(1, 13)
        c = hw5_cards.Deck()
        len_before = len(c.cards)
        card = hw5_cards.Card(suit, rank)
        c.replace_card(card)
        len_after = len(c.cards)
        self.assertEqual(len_before, len_after)

        X = len_before
        Y = len_after
        return X, Y
Ejemplo n.º 11
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.

        '''
        #creating Deck instance
        c10 = hw5_cards.Deck()
        #deal one card from the card and store the card properties
        card = c10.deal_card()
        #deal another card from the card and store the card properties
        #card2 = c10.deal_card()
        #check the length of deck with 2 cards dealt
        deal_len = len(c10.cards)
        #replace a card into the deck
        c10.replace_card(card)
        #try to replace same card into deck
        c10.replace_card(card)
        #check length of deck after two replace attempts
        replace_len = len(c10.cards)
        #compare the two lengths to make sure that
        #it ignores the attempt if the same card is tried
        self.assertEqual(replace_len, deal_len + 1)

        return replace_len, deal_len + 1
Ejemplo n.º 12
0
    def test_q8_alt(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.

        '''
        q8 = hw5_cards.Deck()
        q8.deal_card()
        newDeck = q8.cards
        newDeckCount = len(newDeck)

        # Attempt to replace with card already in newDeck
        for c in newDeck:
            q8.replace_card(c)

        finalDeckCount = len(q8.cards)

        # Test that 'replace_card' method did not change deck size
        # if the card is already in the deck
        self.assertEqual(newDeckCount, finalDeckCount)

        return newDeckCount, finalDeckCount
Ejemplo n.º 13
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.

        '''
        #creating Deck instance
        c9 = hw5_cards.Deck()
        #dealing card and capturing instance
        card = c9.deal_card()
        #checking length of deck after dealing card
        deal_len = len(c9.cards)
        #replacing card back into deck
        c9.replace_card(card)
        #checking length of deck with card replaced
        replace_len = len(c9.cards)
        #comparing length of card before and after replacing
        self.assertEqual(replace_len, deal_len + 1)

        return replace_len, deal_len + 1
Ejemplo n.º 14
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.

        '''
        cards = []
        d5 = hw5_cards.Deck()
        d5_old = len(d5.cards)
        for card in d5.cards:
            cards.append(card.__str__())
        if card.__str__() not in cards:
            d5.replace_card(card)
        else:
            pass
        d5_new = len(d5.cards)
        self.assertEqual(d5_old, d5_new)

        return d5_old, d5_new
Ejemplo n.º 15
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.

        '''
        q7 = hw5_cards.Deck()
        dealt_card = q7.deal_card()
        deckInitialCount = len(q7.cards)

        # Replace with same card dealt
        q7.replace_card(dealt_card)
        deckEndCount = len(q7.cards)

        # Testing that that end count is one greater than the initial
        # Expected count value is '52'
        self.assertEqual((deckInitialCount + 1), deckEndCount, 52)

        return (deckInitialCount + 1), deckEndCount, 52
Ejemplo n.º 16
0
 def test1_init(self):
     d = hw5_cards.Deck() # create a deck
     d.shuffle() # shuffle the deck
     hand_size = random.randint(1,51) # generate a random hand size
     hand = d.deal_hand(hand_size) # create a temp hand list from deck also update the deck
     h = hw5_cards_ec1.Hand(hand) # create hand object
     for i in range(0,hand_size):
         self.assertEqual(h.cards[i].__str__(), hand[i].__str__())
Ejemplo n.º 17
0
 def testAddAndRemove(self):
     deck = hw5.Deck()
     card_missing=deck.deal_card()
     hand = ec1.Hand(deck.cards)
     for i in hand.init_card:
         hand.add_card(i)
         self.assertEqual(len(hand.init_card), 51)
     hand.add_card(card_missing)
     self.assertEqual(len(hand.init_card),52)
Ejemplo n.º 18
0
    def test_q6(self):
        '''
        1. fill in your test method for question 6:
        
        Test that if you invoke the deal_card method on a deck, the deck has one fewer cards in it afterwards.
        
        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.

        '''
        deck = hw5_cards.Deck().cards
        new_deck = hw5_cards.Deck()
        new_deck.deal_card()
        newdeck = new_deck.cards
        self.assertEqual(len(newdeck),len(deck)-1)
        return len(newdeck),len(deck)-1
Ejemplo n.º 19
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.

        '''
        d_original = hw5_cards.Deck()
        d1 = hw5_cards.Deck()
        c1 = hw5_cards.Card(0, 12)
        d1.replace_card(c1)
        self.assertEqual(len(d1.cards), len(d_original.cards))
        return len(d1.cards), len(d_original.cards)
Ejemplo n.º 20
0
 def test3_draw(self):
     d = hw5_cards.Deck() # create a deck
     d.shuffle() # shuffle the deck
     hand_size = random.randint(1,51) # generate a random hand size
     hand = d.deal_hand(hand_size) # create a temp hand list from deck also update the deck
     h = hw5_cards_ec1.Hand(hand) # create hand object
     num_cards_in_hand = len(h.cards) # how many cards in the hand now
     num_cards_in_dect = len(d.cards) # how many cards in the dect now
     h.draw(d)
     self.assertEqual(len(h.cards), num_cards_in_hand+1)
     self.assertEqual(len(d.cards), num_cards_in_dect-1)
Ejemplo n.º 21
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.

        '''
        d_original = hw5_cards.Deck()
        d1 = hw5_cards.Deck()
        card_dealt = d1.deal_card()
        d2 = d1
        d3 = len(d2.cards)
        d2.replace_card(card_dealt)
        self.assertEqual(len(d2.cards), len(d_original.cards), d3 + 1)
        return len(d2.cards), len(d_original.cards), d3 + 1
Ejemplo n.º 22
0
    def test_q6(self):
        '''
        1. fill in your test method for question 6:
        
        Test that if you invoke the deal_card method on a deck, the deck has one fewer cards in it afterwards.
        
        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.

        '''
        #creating Deck instance
        c7 = hw5_cards.Deck()
        #dealing out one card
        c7.deal_card()
        #creating Deck instance
        c8 = hw5_cards.Deck()
        #comparing two instances one with card dealt(c7) and one without (c8)
        self.assertEqual(len(c8.cards) - 1, len(c7.cards))

        return len(c8.cards) - 1, len(c7.cards)
Ejemplo n.º 23
0
    def test_draw(self):
        '''
        Test that if you invoke the draw method from a deck and add it to the hand, the Hand has one more cards in it afterwards.
        Test that if you invoke the draw method with a Hand that caused a side effect: the deck will be depleted by one card.

        '''

        c1 = hw5_cards.Card(1, 1)
        c2 = hw5_cards.Card(0, 2)
        d1 = hw5_cards.Deck()
        h1 = hw5_cards_ec1.Hand([c1, c2])
        self.assertEqual(len(h1.init_cards), 2)
        self.assertEqual(len(d1.cards), 52)
        h1.draw(d1)
        self.assertEqual(len(h1.init_cards), 3)
        self.assertEqual(len(d1.cards), 51)

        d2 = hw5_cards.Deck()
        self.assertEqual(len(d2.cards), 52)
        for i in range(len(d2.cards)-1):
            d2.cards.pop(-1)
        h1.draw(d2)
        self.assertEqual(len(h1.init_cards), 4)
        self.assertEqual(len(d2.cards), 0)
Ejemplo n.º 24
0
 def test2_AddAndRemove(self):
     d = hw5_cards.Deck() # create a deck
     d.shuffle() # shuffle the deck
     hand_size = random.randint(1,51) # generate a random hand size
     hand = d.deal_hand(hand_size) # create a temp hand list from deck also update the deck
     h = hw5_cards_ec1.Hand(hand) # create hand object
     num_cards_in_hand = len(h.cards) # how many cards in the hand now
     c_new = d.deal_card() # create a card in the deck but not in the hand
     c_old = h.cards[random.randint(0,len(h.cards)-1)] # create a card in the hand but not in the deck
     h.add_card(c_old)
     self.assertEqual(len(h.cards), num_cards_in_hand)
     h.add_card(c_new)
     self.assertEqual(len(h.cards), num_cards_in_hand+1)
     h.remove_card(c_new)
     self.assertEqual(len(h.cards), num_cards_in_hand)
     h.remove_card(c_old)
     self.assertEqual(len(h.cards), num_cards_in_hand-1)
    def test_q6(self):
        '''
        1. fill in your test method for question 6:
        
        Test that if you invoke the deal_card method on a deck, the deck has one fewer cards in it afterwards.
        
        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 = hw5_cards.Deck()
        num1 = len(d1.cards)  # number of cards before deal_card
        d2 = d1.deal_card()
        num2 = len(d1.cards)  # number of cards after deal_card
        self.assertEqual(num1 - 1, num2)
        return (num1 - 1, num2)
Ejemplo n.º 26
0
    def test_q6(self):
        '''
        1. fill in your test method for question 6:
        
        Test that if you invoke the deal_card method on a deck, the deck has one fewer cards in it afterwards.
        
        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.

        '''
        q6 = hw5_cards.Deck()
        original_length = len(q6.cards)
        q6.deal_card()
        current_length = len(q6.cards)
        self.assertEqual((original_length, current_length), (52, 51))
        return current_length, 51
Ejemplo n.º 27
0
    def test_q6(self):
        '''
        1. fill in your test method for question 6:
        
        Test that if you invoke the deal_card method on a deck, the deck has one fewer cards in it afterwards.
        
        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.

        '''
        q6 = hw5_cards.Deck()
        q61 = q6.deal_card(
        )  # deal_card() will remote the card from q6, and return the removed card
        self.assertEqual(len(q6.cards),
                         51)  #q6 is the list after the pop function
        return len(q6.cards), 51
Ejemplo n.º 28
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.

        '''
        deck = hw5_cards.Deck()
        card = hw5_cards.Card(
        )  # card to be added, which is already in the deck
        num_cards = len(deck.cards)  # number of cards after deal card
        deck.replace_card(card)  # try to add the card
        self.assertEqual(num_cards, len(deck.cards))
Ejemplo n.º 29
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.

        '''
        test_deck = hw5_cards.Deck()
        card_already_exist = test_deck.cards[random.randint(0, 51)]
        current_size = len(test_deck.cards)
        test_deck.replace_card(card_already_exist)
        after_replace_size = len(test_deck.cards)
        self.assertEqual(current_size, after_replace_size)
        return current_size, after_replace_size
    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 = hw5_cards.Deck()
        c1 = d1.deal_card(-4)
        num1 = len(d1.cards)  # number of cards before replace_card
        d1.replace_card(c1)
        num2 = len(d1.cards)  # number of cards after replace_card
        self.assertEqual(num2, num1 + 1)
        return (num2, num1 + 1)