Changeset 296
- Timestamp:
- 01/29/08 23:26:49 (10 months ago)
- Files:
-
- trunk/src/dm/application.py (modified) (1 diff)
- trunk/src/dm/builder.py (modified) (2 diffs)
- trunk/src/dm/db.py (modified) (9 diffs)
- trunk/src/dm/dom/base.py (modified) (3 diffs)
- trunk/src/dm/dom/meta.py (modified) (6 diffs)
- trunk/src/dm/dom/registry.py (modified) (3 diffs)
- trunk/src/dm/dom/temporaltest.py (modified) (2 diffs)
- trunk/src/dm/test.py (modified) (2 diffs)
- trunk/src/dm/testunit.py (modified) (1 diff)
- trunk/src/dm/timepoint.py (added)
- trunk/src/dm/timepointtest.py (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/dm/application.py
r97 r296 1 1 from dm.ioc import * 2 2 from dm.builder import ApplicationBuilder 3 from dm.testunit import ApplicationBuilder 3 4 4 5 class Application(object): trunk/src/dm/builder.py
r18 r296 19 19 features.register('FileSystem', self.findFileSystem()) 20 20 features.register('AccessController', self.findAccessController()) 21 features.register('Timepoint', self.findTimepoint()) 21 22 22 23 def findSystemDictionary(self): … … 64 65 return dm.accesscontrol.SystemAccessController() 65 66 67 def findTimepoint(self): 68 import dm.timepoint 69 return dm.timepoint.Timepoint() 70 trunk/src/dm/db.py
r294 r296 48 48 debug = RequiredFeature('Debug') 49 49 logger = RequiredFeature('Logger') 50 timepoint = RequiredFeature('Timepoint') 50 51 51 52 moddebug = False … … 144 145 if '__dateCreatedAfter__' in kwds: 145 146 return True 147 if '__dateCreatedOnOrBefore__' in kwds: 148 return True 146 149 if '__dateCreatedBefore__' in kwds: 147 150 return True … … 191 194 return records 192 195 193 def createDomainObject(self, className, *args, **kwds):196 def createDomainObject(self, className, __loadedList__=None, *args, **kwds): 194 197 "Create new recorded domain object." 195 198 newRecord = self.createRecord(className, *args, **kwds) … … 197 200 message = "Created new db record. %s" % newRecord 198 201 logger.debug(message) 199 newObject = newRecord.getDomainObject( )202 newObject = newRecord.getDomainObject(loadedList=__loadedList__) 200 203 return newObject 201 204 … … 491 494 mapperAttributes['_table'] = self.dbName 492 495 for a in self.attributes: 496 if a.dom.isTemporal: 497 continue 493 498 mapperClassAttribute = a.createMapperClassAttribute() 494 499 if mapperClassAttribute: … … 738 743 logger.debug(message) 739 744 self.domainObject.id = self.id 745 recordedTime = timepoint.recorded 740 746 for metaAttr in self.meta.attributes: 741 747 dbName = metaAttr.dbName … … 746 752 ) 747 753 logger.debug(message) 748 if metaAttr.isDomainObjectRef: 754 if metaAttr.dom.isTemporal: 755 r = metaAttr.dom.createTemporalCollection(self.domainObject) 756 mostRecent = r.findFirstDomainObject( 757 __loadedList__=loadedList, 758 __dateCreatedOnOrBefore__=recordedTime 759 ) 760 if mostRecent: 761 mappedValue = mostRecent.recordedValue 762 else: 763 mappedValue = metaAttr.dom.createInitialValue( 764 self.domainObject 765 ) 766 elif metaAttr.isDomainObjectRef: 749 767 mapper = getattr(self, dbName) 750 768 if mapper: … … 780 798 isChanged = False 781 799 for metaAttr in self.meta.attributes: 782 if metaAttr.isDomainObjectRef: 800 if metaAttr.dom.isTemporal: 801 domValue = getattr(self.domainObject, metaAttr.domName) 802 r = metaAttr.dom.createTemporalCollection(self.domainObject) 803 loadedList = {} 804 loadedList[self.domainObject] = self.domainObject 805 mostRecent = r.findFirstDomainObject(__loadedList__=loadedList) 806 #print "SAVE: Dom value (%s)" % (domValue) 807 if mostRecent != None: 808 #print "SAVE: Most recent (%s)" % (mostRecent.recordedValue) 809 if domValue != mostRecent.recordedValue: 810 #print "SAVE: Stale version record. Creating new..." 811 r.create(recordedValue=domValue, 812 __loadedList__=loadedList) 813 else: 814 pass # print "SAVE: Fresh version record." 815 else: 816 #print "SAVE: No version record. Creating new..." 817 r.create(recordedValue=domValue,__loadedList__=loadedList) 818 elif metaAttr.isDomainObjectRef: 783 819 domainObject = getattr(self.domainObject, metaAttr.domName) 784 820 if domainObject and hasattr(domainObject, 'record'): … … 969 1005 ) 970 1006 sqlEqualsList.append(sqlEquals) 1007 elif name == '__dateCreatedOnOrBefore__': 1008 sqlSafeName = self.makeSqlName('date_created') 1009 sqlEquals = "%s <= %s" % ( 1010 sqlSafeName, sqlSafeValue 1011 ) 1012 sqlEqualsList.append(sqlEquals) 971 1013 elif name == '__dateCreatedAfter__': 972 1014 sqlSafeName = self.makeSqlName('date_created') trunk/src/dm/dom/base.py
r290 r296 245 245 object.save() 246 246 except KforgeDbError, inst: 247 raise KforgeDomError, inst 247 raise KforgeDomError, inst 248 248 else: 249 249 return object … … 282 282 return None 283 283 284 def findDomainObjects(self, **kwds):284 def findDomainObjects(self, __loadedList__=None, **kwds): 285 285 objectList = [] 286 286 for record in self.findRecords(**kwds): 287 domainObject = record.getDomainObject( )287 domainObject = record.getDomainObject(__loadedList__) 288 288 objectList.append(domainObject) 289 289 self.sortDomainObjects(objectList) … … 673 673 self.decacheItem() 674 674 if self.record: 675 self.deleteTemporalAttributeObjects() 675 676 self.record.domainObject = None 676 677 self.record.destroySelf() 677 678 self.record = None 679 680 def deleteTemporalAttributeObjects(self): 681 for metaAttr in self.meta.attributes: 682 if metaAttr.isTemporal: 683 r = metaAttr.createTemporalCollection(self) 684 [i.delete() for i in r] 678 685 679 686 def purgeAggregates(self): trunk/src/dm/dom/meta.py
r294 r296 112 112 113 113 114 class TemporalCollection(object): 115 116 def __init__(self, register): 117 self.register = register 118 119 def __get__(self, obj, type=None): 120 print "Got __get__()" 121 122 def __set__(self, obj, value): 123 print "Got __set__(%s)" % value 124 125 114 126 class MetaDomainAttr(MetaBase): 115 127 "Models a domain object attribute." … … 120 132 isImageFile = False 121 133 122 def __init__(self, typeName='', name='', dbName='', default=NotDefined, title='', comment='', isEditable=True, isHidden=False, isRequired=True, getChoices=None, isTemporal=False, is Indexed=False, **kwds):134 def __init__(self, typeName='', name='', dbName='', default=NotDefined, title='', comment='', isEditable=True, isHidden=False, isRequired=True, getChoices=None, isTemporal=False, isBitemporal=False, isIndexed=False, **kwds): 123 135 self.typeName = typeName 124 136 self.name = name … … 139 151 self.isIndexed = isIndexed 140 152 self.isTemporal = isTemporal 153 if self.isIndexed and self.isTemporal: 154 raise Exception, "Can't be indexed and temporal, at the mo." 155 self.isBitemporal = isBitemporal 156 if self.isBitemporal: 157 self.isTemporal = True 158 self.isBitemporal = False # Cut this out for the moment. 159 self.temporalDomainClass = None 141 160 142 161 def __repr__(self): … … 163 182 setattr(domainObject, self.name, initialValue) 164 183 184 def setTemporalDomainClass(self, domainClass): 185 self.temporalDomainClass = domainClass 186 self.temporalDomainClass.registerKeyName = 'dateCreated' 187 self.temporalDomainClass.isCached = True 188 self.temporalDomainClass.sortOnName = 'id' 189 self.temporalDomainClass.sortAscending = False 190 191 def createTemporalCollection(self, domainObject): 192 register = self.temporalDomainClass.createRegister() 193 register.ownerName = 'parent' 194 register.owner = domainObject 195 return register 196 165 197 def createInitialValue(self, domainObject): 166 198 return None … … 226 258 dbValue = domainValue 227 259 return dbValue 260 261 def duplicateTemporal(self): 262 attrMeta = self.duplicateSelf() 263 # Not bitemporal ATM. Just an idea for 'stepping down' the temporal: 264 if self.isBitemporal: 265 attrMeta.isTemporal = True 266 attrMeta.isBitemporal = False 267 else: 268 attrMeta.isTemporal = False 269 return attrMeta 270 271 def duplicateSelf(self): 272 return type(self)() 228 273 229 274 … … 546 591 self.logger.debug(msg) 547 592 return attrValue 593 594 def duplicateSelf(self): 595 return type(self)(self.typeName) 548 596 549 597 trunk/src/dm/dom/registry.py
r272 r296 5 5 from dm.exceptions import * 6 6 import inspect 7 import dm.times 7 8 8 9 class DomainRegistry(AbstractList): … … 29 30 domainClass = metaDomainObject.createDomainClass(baseClass) 30 31 self.registerDomainClass(domainClass) 32 return domainClass 31 33 32 34 def getDomainClassRegister(self): … … 82 84 for name in classRegister: 83 85 self.checkHasAsForHasManys(classRegister[name]) 86 self.createTemporalAttributePersistence(domainClass.meta) 87 88 def createTemporalAttributePersistence(self, domainClassMeta): 89 temporalAttrs = [] 90 for a in domainClassMeta.attributes: 91 if a.isTemporal: 92 new = self.createTemporalDomainClass(domainClassMeta, a) 93 a.setTemporalDomainClass(new) 94 95 def createTemporalDomainClass(self, classMeta, attrMeta): 96 temporalClassName = classMeta.name + '_t_' + attrMeta.name 97 metaTemporalObject = DomainObject.metaClass(temporalClassName) 98 metaTemporalObject.recordedValue = attrMeta.duplicateTemporal() 99 metaTemporalObject.parent = HasA(classMeta.name, isRequired=True) 100 metaTemporalObject.dateCreated = DateTime(isIndexed=True, 101 isRequired=True, default=mx.DateTime.now) 102 return self.createDomainClass(metaTemporalObject) 84 103 85 104 def setMetaAttributesFromClass(self, domainClass, domainClassMeta): trunk/src/dm/dom/temporaltest.py
r295 r296 2 2 from dm.dom.testunit import TestCase 3 3 from dm.exceptions import * 4 from dm.dom.stateful import SimpleNamedObject, String, DateTime 4 from dm.dom.stateful import SimpleNamedObject, String, DateTime, HasA 5 from dm.dom.base import DomainObjectRegister 6 from dm.ioc import RequiredFeature 7 import mx.DateTime 8 from time import sleep 5 9 6 10 def suite(): 7 11 suites = [ 8 unittest.makeSuite(TestTemporal Attributed),12 unittest.makeSuite(TestTemporal), 9 13 ] 10 14 return unittest.TestSuite(suites) … … 13 17 # Todo: Separate out the testing of indexes from testing of temporal attribute. 14 18 15 class Temporal Attributed(SimpleNamedObject):19 class Temporal(SimpleNamedObject): 16 20 "Temporally attributed domain object." 17 21 18 name = String(default='', isTemporal=True, isIndexed=True) 19 description = String(default='', isTemporal=True, isIndexed=True) 20 dateTime = DateTime(isTemporal=True, isIndexed=True) 21 22 23 class TestTemporalAttributed(TestCase): 24 "TestCase for the TemporalAttributed class." 22 # Todo: Exception when register key attribute is temporal. 23 name = String(default='', isIndexed=True) 24 description = String(default='', isTemporal=True) 25 firstkiss = DateTime(isTemporal=True, default=mx.DateTime.now()) 26 state = HasA('State', isTemporal=True, isRequired=None) 27 haircolor = String(default='', isBitemporal=True) 28 29 30 class TestTemporal(TestCase): 31 "TestCase for the Temporal class." 32 33 timepoint = RequiredFeature('Timepoint') 25 34 26 35 def setUp(self): 27 super(TestTemporalAttributed, self).setUp() 28 self.fixtureName = 'TestTemporalAttributed' 29 self.temporalAttributeds = self.registry.temporalAttributeds 30 try: 31 temporalAttributed = self.temporalAttributeds[self.fixtureName] 32 temporalAttributed.delete() 33 temporalAttributed.purge() 34 except: 35 self.temporalAttributed = self.temporalAttributeds.create(self.fixtureName) 36 self.fixture = self.temporalAttributed 36 super(TestTemporal, self).setUp() 37 self.fixtureName = 'TestTemporal' 38 self.temporals = self.registry.temporals 39 if self.fixtureName in self.temporals: 40 del(self.temporals[self.fixtureName]) 41 self.fixture = self.temporals.create(self.fixtureName) 42 self.temporal = self.fixture 37 43 for i in range(1,5): 38 44 newName = "%s%s" % (self.fixtureName, i) 39 self.temporal Attributeds.create(newName)45 self.temporals.create(newName) 40 46 41 47 def tearDown(self): 42 48 for i in range(1,5): 43 49 newName = "%s%s" % (self.fixtureName, i) 44 del(self.temporalAttributeds[newName]) 45 try: 46 temporalAttributed = self.temporalAttributeds[self.fixtureName] 47 temporalAttributed.delete() 48 temporalAttributed.purge() 49 except: 50 pass 51 self.temporalAttributed = None 50 del(self.temporals[newName]) 51 if self.fixture: 52 fixture = self.fixture 53 if self.fixtureName in self.temporals: 54 del(self.temporals[self.fixtureName]) 55 self.temporal = None 52 56 53 57 def test_meta(self): 54 58 metaAttr = self.fixture.meta.attributeNames['description'] 55 self.failUnlessEqual(metaAttr.isIndexed, True) 56 metaAttr = self.fixture.meta.attributeNames['dateTime'] 57 self.failUnlessEqual(metaAttr.isIndexed, True) 59 self.failUnlessEqual(metaAttr.isIndexed, False) 60 self.failUnlessEqual(metaAttr.isTemporal, True) 61 metaAttr = self.fixture.meta.attributeNames['firstkiss'] 62 self.failUnlessEqual(metaAttr.isIndexed, False) 63 self.failUnlessEqual(metaAttr.isTemporal, True) 58 64 metaAttr = self.fixture.meta.attributeNames['name'] 59 65 self.failUnlessEqual(metaAttr.isIndexed, True) 66 self.failUnlessEqual(metaAttr.isTemporal, False) 60 67 61 68 def test_new(self): 62 self.failUnless(self. temporalAttributed, "New temporalAttributed could not be created.")69 self.failUnless(self.fixture) 63 70 self.failUnlessRaises(KforgeDomError, 64 self.registry.temporal Attributeds.create, self.fixtureName71 self.registry.temporals.create, self.fixtureName 65 72 ) 73 self.failUnlessEqual(type(self.fixture.description), type("")) 74 self.failUnlessEqual(self.fixture.description, "") 75 66 76 67 77 def test_find(self): 68 self.failUnless(self.registry.temporal Attributeds['TestTemporalAttributed'],69 "New temporal Attributedcould not be found."78 self.failUnless(self.registry.temporals['TestTemporal'], 79 "New temporal could not be found." 70 80 ) 71 81 self.failUnlessRaises(KforgeRegistryKeyError, 72 self.registry.temporal Attributeds.__getitem__, 'TestAlien'82 self.registry.temporals.__getitem__, 'TestAlien' 73 83 ) 74 84 75 85 def test_save(self): 76 self.assertEquals(self.temporalAttributed.description, "", "Already has a description.") 77 self.temporalAttributed.description = "Test TemporalAttributed" 78 self.assertEquals(self.temporalAttributed.description, "Test TemporalAttributed", 79 "TemporalAttributed doesn't have attribute." 80 ) 81 self.temporalAttributed.save() 82 temporalAttributed = self.temporalAttributeds[self.fixtureName] 83 self.assertEquals(temporalAttributed.description, "Test TemporalAttributed", 84 "Retrieved temporalAttributed has wrong description." 85 ) 86 temporalAttributed.description = "Other TemporalAttributed" 87 self.assertEquals(self.temporalAttributed.description, "Other TemporalAttributed", 88 "Suspect duplicate domain objects!!" 89 ) 90 86 self.failUnlessEqual(self.temporal.description, "", "Already has a description.") 87 self.temporal.description = "Test Temporal" 88 self.failUnlessEqual(self.temporal.description, "Test Temporal", "Temporal doesn't have attribute.") 89 self.temporal.save() 90 temporal = self.temporals[self.fixtureName] 91 self.failUnlessEqual(temporal.description, "Test Temporal") 92 temporal.description = "Other Temporal" 93 self.failUnlessEqual(self.temporal.description, "Other Temporal", "Suspect duplicate domain objects!!") 94 temporal.save() 95 self.failUnlessEqual(temporal.description, "Other Temporal", "Suspect broken temporal attribute: %s" % temporal.description) 96 temporal.save() 97 self.failUnlessEqual(temporal.description, "Other Temporal", "Suspect broken temporal attribute: %s" % temporal.description) 98 temporal.save() 99 temporal = self.temporals[self.fixtureName] 100 self.failUnlessEqual(temporal.description, "Other Temporal", "Suspect broken temporal attribute: %s" % temporal.description) 101 102 # Make changes to the recorded time. 103 state1 = self.registry.states['active'] 104 state2 = self.registry.states['pending'] 105 state3 = self.registry.states['deleted'] 106 time1 = mx.DateTime.DateTime(2007, 6, 1, 0, 0 ,0) 107 time2 = mx.DateTime.DateTime(2007, 7, 1, 0, 0 ,0) 108 time3 = mx.DateTime.DateTime(2007, 8, 1, 0, 0 ,0) 109 description1 = "Recent Description" 110 description2 = "Most Recent Description" 111 description3 = "Next Most Recent Description" 112 haircolor0 = "Ancient Haircolor" 113 haircolor1 = "Recent Haircolor" 114 haircolor2 = "Most Recent Haircolor" 115 haircolor3 = "Next Most Recent Haircolor" 116 haircolor4 = "Omg Next Most Recent Haircolor" 117 temporal.description = description1 118 temporal.firstkiss = time1 119 temporal.state = state1 120 temporal.haircolor = haircolor1 121 temporal.save() 122 revisionTime = mx.DateTime.now() 123 sleep(3) 124 temporal.description = description2 125 temporal.firstkiss = time2 126 temporal.state = state2 127 temporal.haircolor = haircolor2 128 temporal.save() 129 # - check present is most recent 130 self.timepoint.reset() 131 temporal = self.temporals[self.fixtureName] 132 self.failUnlessEqual(temporal.description, description2) 133 self.failUnlessEqual(temporal.firstkiss, time2) 134 self.failUnlessEqual(temporal.state, state2) 135 self.failUnlessEqual(temporal.haircolor, haircolor2) 136 # - check revisionTime is 'recent' 137 self.timepoint.recorded = revisionTime 138 temporal = self.temporals[self.fixtureName] 139 self.failUnlessEqual(temporal.description, description1) 140 self.failUnlessEqual(temporal.firstkiss, time1) 141 self.failUnlessEqual(temporal.state, state1) 142 self.failUnlessEqual(temporal.haircolor, haircolor1) 143 # - check we can return to the present 144 self.timepoint.reset() 145 temporal = self.temporals[self.fixtureName] 146 self.failUnlessEqual(temporal.description, description2) 147 self.failUnlessEqual(temporal.firstkiss, time2) 148 self.failUnlessEqual(temporal.state, state2) 149 self.failUnlessEqual(temporal.haircolor, haircolor2) 150 # - check a new value comes through ok 151 temporal.description = description3 152 temporal.firstkiss = time3 153 temporal.state = state3 154 temporal.haircolor = haircolor3 155 temporal.save() 156 temporal = self.temporals[self.fixtureName] 157 self.failUnlessEqual(temporal.description, description3) 158 self.failUnlessEqual(temporal.firstkiss, time3) 159 self.failUnlessEqual(temporal.state, state3) 160 self.failUnlessEqual(temporal.haircolor, haircolor3) 161 162 # Make changes to the actual time. 163 164 165 return 166 167 168 self.timepoint.reset() 169 temporal = self.temporals[self.fixtureName] 170 self.failUnlessEqual(temporal.haircolor, haircolor3) 171 yearsAgo = mx.DateTime.DateTime(2001, 6, 1, 0, 0, 0) 172 self.timepoint.actual = yearsAgo 173 temporal.haircolor = haircolor0 174 temporal.save() 175 temporal = self.temporals[self.fixtureName] 176 self.failUnlessEqual(temporal.haircolor, haircolor0) 177 self.timepoint.reset() 178 temporal = self.temporals[self.fixtureName] 179 self.failUnlessEqual(temporal.haircolor, haircolor3) 180 self.timepoint.actual = yearsAgo 181 temporal = self.temporals[self.fixtureName] 182 self.failUnlessEqual(temporal.haircolor, haircolor0) 183 self.timepoint.reset() 184 temporal = self.temporals[self.fixtureName] 185 self.failUnlessEqual(temporal.haircolor, haircolor3) 186 self.timepoint.recorded = revisionTime 187 self.timepoint.actual = yearsAgo 188 temporal = self.temporals[self.fixtureName] 189 self.failUnlessEqual(temporal.haircolor, '') 190 self.timepoint.reset() 191 self.timepoint.recorded = revisionTime 192 temporal = self.temporals[self.fixtureName] 193 self.failUnlessEqual(temporal.haircolor, haircolor1) 194 91 195 def test_count(self): 92 self.failUnless(self.temporal Attributeds.count(), "Problem with temporalAttributedcount.")196 self.failUnless(self.temporals.count(), "Problem with temporal count.") 93 197 94 198 def test_keys(self): 95 self.failUnless(self.temporal Attributeds.keys(), "Problem with temporalAttributedlist.")199 self.failUnless(self.temporals.keys(), "Problem with temporal list.") 96 200 97 201 def test_iter(self): 98 self.failUnless(self.temporal Attributeds.__iter__(), "Problem with temporalAttributediter.")99 for p in self.temporal Attributeds:100 self.failUnless(p.name, "Problem with iteration temporal Attributed: %s" % p)202 self.failUnless(self.temporals.__iter__(), "Problem with temporal iter.") 203 for p in self.temporals: 204 self.failUnless(p.name, "Problem with iteration temporal: %s" % p) 101 205 102 206 def test_getNextObject(self): 103 temporal AttributedList = self.temporalAttributeds.getSortedList()104 lenList = len(temporal AttributedList)207 temporalList = self.temporals.getSortedList() 208 lenList = len(temporalList) 105 209 self.failUnless(lenList >= 4, lenList) 106 temporal Attributed = temporalAttributedList[-3]107 nextTemporal Attributed = self.temporalAttributeds.getNextObject(temporalAttributedList, temporalAttributed)108 self.failUnlessEqual(nextTemporal Attributed, temporalAttributedList[-2])109 nextTemporal Attributed = self.temporalAttributeds.getNextObject(temporalAttributedList, nextTemporalAttributed)110 self.failUnlessEqual(nextTemporal Attributed, temporalAttributedList[-1])111 nextTemporal Attributed = self.temporalAttributeds.getNextObject(temporalAttributedList, nextTemporalAttributed)112 self.failIf(nextTemporal Attributed)210 temporal = temporalList[-3] 211 nextTemporal = self.temporals.getNextObject(temporalList, temporal) 212 self.failUnlessEqual(nextTemporal, temporalList[-2]) 213 nextTemporal = self.temporals.getNextObject(temporalList, nextTemporal) 214 self.failUnlessEqual(nextTemporal, temporalList[-1]) 215 nextTemporal = self.temporals.getNextObject(temporalList, nextTemporal) 216 self.failIf(nextTemporal) 113 217 114 218 def test_getPreviousObject(self): 115 temporal AttributedList = self.temporalAttributeds.getSortedList()116 lenList = len(temporal AttributedList)219 temporalList = self.temporals.getSortedList() 220 lenList = len(temporalList) 117 221 self.failUnless(lenList >= 4, lenList) 118 temporal Attributed = temporalAttributedList[2]119 previousTemporal Attributed = self.temporalAttributeds.getPreviousObject(temporalAttributedList, temporalAttributed)120 self.failUnlessEqual(previousTemporal Attributed, temporalAttributedList[1])121 previousTemporal Attributed = self.temporalAttributeds.getPreviousObject(temporalAttributedList, previousTemporalAttributed)122 self.failUnlessEqual(previousTemporal Attributed, temporalAttributedList[0])123 previousTemporal Attributed = self.temporalAttributeds.getPreviousObject(temporalAttributedList, previousTemporalAttributed)124 self.failIf(previousTemporal Attributed)125 126 222 temporal = temporalList[2] 223 previousTemporal = self.temporals.getPreviousObject(temporalList, temporal) 224 self.failUnlessEqual(previousTemporal, temporalList[1]) 225 previousTemporal = self.temporals.getPreviousObject(temporalList, previousTemporal) 226 self.failUnlessEqual(previousTemporal, temporalList[0]) 227 previousTemporal = self.temporals.getPreviousObject(temporalList, previousTemporal) 228 self.failIf(previousTemporal) 229 230 trunk/src/dm/test.py
r254 r296 1 1 import dm.timestest 2 import dm.timepointtest 2 3 import dm.strategytest 3 4 import dm.environmenttest … … 23 24 suites = [ 24 25 dm.timestest.suite(), 26 dm.timepointtest.suite(), 25 27 dm.strategytest.suite(), 26 28 dm.environmenttest.suite(), trunk/src/dm/testunit.py
r294 r296 22 22 def construct(self): 23 23 super(ModelBuilder, self).construct() 24 self.loadTemporal Attributed()24 self.loadTemporal() 25 25 26 def loadTemporal Attributed(self):27 from dm.dom.temporaltest import Temporal Attributed28 self.registry.registerDomainClass(Temporal Attributed)29 self.registry.temporal Attributeds = TemporalAttributed.createRegister()26 def loadTemporal(self): 27 from dm.dom.temporaltest import Temporal 28 self.registry.registerDomainClass(Temporal) 29 self.registry.temporals = Temporal.createRegister() 30 30 31 31
