def testRemoveCompositeAndChildRemovesBoth(self): self.composite.addChild(self.composite2) grandChild = patterns.ObservableComposite() self.composite2.addChild(grandChild) self.collection.append(self.composite) self.collection.removeItems([self.composite2, grandChild]) self.assertEqual([self.composite], self.collection)
def testRemoveCompositeWithChildRemovesChildToo(self): self.composite.addChild(self.composite2) grandChild = patterns.ObservableComposite() self.composite2.addChild(grandChild) self.collection.append(self.composite) self.collection.remove(self.composite2) self.assertEqual([self.composite], self.collection)
def testRemoveChildWithChildren_CollectionNotificationContainsParentAndChild(self): self.registerObserver(self.collection.removeItemEventType()) self.composite.addChild(self.composite2) grandChild = patterns.ObservableComposite() self.composite2.addChild(grandChild) self.collection.append(self.composite) self.collection.remove(self.composite2) self.assertEqualLists([self.composite2, grandChild], self.events[0].values(type=self.collection.removeItemEventType()))
def setUp(self): self.composite = patterns.ObservableComposite() self.composite2 = patterns.ObservableComposite() self.collection = patterns.CompositeList()
def setUp(self): self.composite = patterns.ObservableComposite() self.child = patterns.ObservableComposite()