Update of /cvsroot/modeling/ProjectModeling/Modeling/tests
In directory sc8-pr-cvs1:/tmp/cvs-serv23271/Modeling/tests
Modified Files:
test_PyModel.py
Log Message:
* Fixed bug #842698: when a PyModel.Attribute property is set after
instanciation, its value was never propagated to the final Attribute at
build() time.
* Fixed bug #841315: PyModel associations do not set the multiplicity bounds
e.g. a toOne relationship was always [0,1] regardless of what the
definition of the Association.
Index: test_PyModel.py
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/tests/test_PyModel.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** test_PyModel.py 3 Aug 2003 12:54:09 -0000 1.5
--- test_PyModel.py 15 Nov 2003 13:02:41 -0000 1.6
***************
*** 90,94 ****
self.failIf(emp.propertyNamed('id') not in toMarks.sourceAttributes())
self.failIf(mark.propertyNamed('fkEmployee') not in toMarks.destinationAttributes())
! self.failIf(fkStore.isRequired()!=toStore.multiplicityLowerBound())
# Check toStore and toMarks for SalesClerk
--- 90,94 ----
self.failIf(emp.propertyNamed('id') not in toMarks.sourceAttributes())
self.failIf(mark.propertyNamed('fkEmployee') not in toMarks.destinationAttributes())
! self.failIf(fkStore.isRequired()!=toStore.multiplicityLowerBound(), '%i != %i'%(fkStore.isRequired(),toStore.multiplicityLowerBound()))
# Check toStore and toMarks for SalesClerk
***************
*** 148,151 ****
--- 148,170 ----
self.assertEqual(emp.primaryKeyAttributes()[0].defaultValue(), None)
+ def test_01b_attr(self):
+ "[PyModel] attributes' props can be reassigned before build()"
+ # bug #842698
+ model = self.model
+ model.entities = [
+ Entity('Employee', properties=[ AString('firstName', width=30) ] ),
+ ]
+ attr=model.entityNamed('Employee').attributeNamed('firstName')
+ attr.width=50
+ attr.isRequired=1
+ attr.usedForLocking=1
+ model.build()
+ emp=model.component.entityNamed('Employee')
+ self.checkEntitiesProperties((emp,))
+ firstName=emp.attributeNamed('firstName')
+ self.assertEqual(firstName.width(), 50)
+ self.assertEqual(firstName.isRequired(), 1)
+ self.failUnless(firstName in emp.attributesUsedForLocking())
+
def test_02_pk(self):
"[PyModel] entity w/ pk"
***************
*** 402,408 ****
--- 421,429 ----
self.failUnless(mark.propertyNamed('fkEmployee'))
self.failIf(emp.propertyNamed('toStore').deleteRule()!='nullify')
+ self.failUnless(emp.propertyNamed('toStore').isMandatory()) #841315
self.failIf(emp.propertyNamed('toMarks').deleteRule()!='cascade')
self.failIf(store.propertyNamed('toEmployees').deleteRule()!='deny')
self.failIf(mark.propertyNamed('toEmployee').deleteRule()!='nullify')
+ self.failUnless(mark.propertyNamed('toEmployee').isMandatory())
# Check Association's defaults
|