コード例 #1
0
 def setUp(self):
     self.collection = base.Collection()
     self.tracker = base.ChangeTracker(self.collection)
     self.object = base.CompositeObject()
コード例 #2
0
 def testChangeTrackerIgnoresChangesToObjectsNotInCollection(self):
     self.collection.append(self.object)
     self.tracker.reset()
     secondObject = base.CompositeObject()
     secondObject.setSubject('New subject')
     self.failIf(self.tracker.modified())
コード例 #3
0
 def testLookupIdWhenObjectIsInCollection(self):
     domainObject = base.CompositeObject()
     self.collection.append(domainObject)
     self.assertEqual(domainObject,
                      self.collection.getObjectById(domainObject.id()))
コード例 #4
0
 def testSetExpansionStatesViaConstructor(self):
     compositeObject = base.CompositeObject(
         expandedContexts=['context1', 'context2'])
     self.assertEqual(['context1', 'context2'],
                      sorted(compositeObject.expandedContexts()))
コード例 #5
0
 def testSetExpansionStateViaConstructor(self):
     compositeObject = base.CompositeObject(expandedContexts=['None'])
     self.failUnless(compositeObject.isExpanded())
コード例 #6
0
 def addChild(self, **kwargs):
     self.child = base.CompositeObject(**kwargs)
     self.compositeObject.addChild(self.child)
     self.child.setParent(self.compositeObject)
コード例 #7
0
 def setUp(self):
     self.compositeObject = base.CompositeObject()
     self.child = None
     self.eventsReceived = []