def test_extend(self): """ Test extend() method. """ h = Hand(namelist=["AD", "TC", "JS"]) h1 = Hand(namelist=["QH", "2D"]) hr = Hand(namelist=["AD", "TC", "JS", "QH", "2D"]) h.extend(h1) self.assertEqual(h.index_list(), hr.index_list()) self.assertFalse(h._cards[3] is h1._cards[0]) bad_list = [0, 1.5, "spam", Card(name="AS")] for badness in bad_list: self.assertRaises(TypeError, h.extend, badness)