示例#1
0
 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)
示例#2
0
 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)
示例#3
0
 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()))
示例#4
0
 def setUp(self):
     self.composite = patterns.ObservableComposite()
     self.composite2 = patterns.ObservableComposite()
     self.collection = patterns.CompositeList()
示例#5
0
 def setUp(self):
     self.composite = patterns.ObservableComposite()
     self.child = patterns.ObservableComposite()