def test_shuffle_shuffles(self):

        """
        Test that the shuffled card list is different to the
        original card list.

        """

        deck = Deck()
        original_list = deck.get_card_list()
        deck.shuffle()
        shuffled_list = deck.get_card_list()
        self.assertNotEqual(original_list, shuffled_list)
    def test_get_card_list_equals(self):

        """
        Test that the list returned from get_card_list() is
        equal to the internal card list.

        """

        deck = Deck()
        returned_list = deck.get_card_list()
        self.assertEqual(returned_list, deck._cards)
    def test_getitem(self):

        """
        Test operation of the __getitem__ method.

        """

        deck = Deck()
        get_list = deck.get_card_list()
        getitem_list = [deck[idx] for idx in range(52)]
        self.assertEqual(get_list, getitem_list)
    def test_contains(self):

        """
        Test operation of the __contains__ method.

        """

        deck = Deck()
        get_list = deck.get_card_list()
        contains_list = [card for card in deck]
        self.assertEqual(get_list, contains_list)
    def test_get_card_list_not_same(self):

        """
        Test that the list returned from get_card_list() is
        not the same as the internal card list, i.e. that
        the method is returning a copy.

        """

        deck = Deck()
        returned_list = deck.get_card_list()
        self.assertFalse(returned_list is deck._cards)
    def test_setitem(self):

        """
        Test operation of the __setitem__ method.

        """

        deck1 = Deck()
        deck2 = Deck()
        d1_clist = deck1.get_card_list()
        d2_clist = deck1.get_card_list()
        self.assertEqual(d1_clist, d2_clist)

        deck1.shuffle()
        d1_clist = deck1.get_card_list()
        self.assertNotEqual(d1_clist, d2_clist)

        for idx, card in enumerate(d1_clist):
            deck2[idx] = card
        d2_clist = deck2.get_card_list()
        self.assertEqual(d1_clist, d2_clist)