def test_extend(self): ic1 = InteractionComponent(id='test1') ic2 = InteractionComponent(id='test2') arglist = InteractionComponentList([ic1, ic2]) iclist = InteractionComponentList([InteractionComponent(id='test3')]) iclist.extend(arglist) self.assertEqual(len(iclist), 3) self.assertEqual(iclist[0].id, 'test3') self.assertEqual(iclist[1].id, 'test1') self.assertEqual(iclist[2].id, 'test2')
def test_extendExceptionNotComponent(self): ic1 = InteractionComponent(id='test1') arglist = [ic1, 'not InteractionComponent'] iclist = InteractionComponentList([InteractionComponent()]) with self.assertRaises(TypeError): iclist.extend(arglist)