[Modeling-cvs] ProjectModeling/Modeling/tests test_PyModel.py,1.1,1.2 test_EditingContext_Global.py,
Status: Abandoned
Brought to you by:
sbigaret
Update of /cvsroot/modeling/ProjectModeling/Modeling/tests
In directory sc8-pr-cvs1:/tmp/cvs-serv7471/ProjectModeling/Modeling/tests
Modified Files:
test_EditingContext_Global.py
test_EditingContext_Global_Inheritance.py
test_EditingContext_ParentChild.py test_Model.py
Added Files:
test_PyModel.py
Log Message:
Merged branch brch-0_9pre7-1-PyModel. Introducing: ability to express models
in plain python rather than in xml files.
See CHANGES for details.
Index: test_EditingContext_Global.py
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/tests/test_EditingContext_Global.py,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** test_EditingContext_Global.py 4 Jul 2003 16:19:17 -0000 1.25
--- test_EditingContext_Global.py 7 Jul 2003 14:57:14 -0000 1.26
***************
*** 40,44 ****
utils.fixpath()
! from Modeling import ModelSet
from Modeling.EditingContext import EditingContext
from Modeling.FetchSpecification import FetchSpecification
--- 40,44 ----
utils.fixpath()
! from Modeling import ModelSet, Model
from Modeling.EditingContext import EditingContext
from Modeling.FetchSpecification import FetchSpecification
***************
*** 1085,1089 ****
author_books_model=ModelSet.defaultModelSet().modelNamed('AuthorBooks')
# Initialization of model's caracs.
! ModelSet.updateModelWithCFG(author_books_model, database_cfg)
# MySQL specifics: change TIMESTAMP to DATETIME
--- 1085,1089 ----
author_books_model=ModelSet.defaultModelSet().modelNamed('AuthorBooks')
# Initialization of model's caracs.
! Model.updateModelWithCFG(author_books_model, database_cfg)
# MySQL specifics: change TIMESTAMP to DATETIME
Index: test_EditingContext_Global_Inheritance.py
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/tests/test_EditingContext_Global_Inheritance.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** test_EditingContext_Global_Inheritance.py 12 Jun 2003 11:38:06 -0000 1.12
--- test_EditingContext_Global_Inheritance.py 7 Jul 2003 14:57:14 -0000 1.13
***************
*** 40,44 ****
utils.fixpath()
! from Modeling import ModelSet
from Modeling.EditingContext import EditingContext
from Modeling.FetchSpecification import FetchSpecification
--- 40,44 ----
utils.fixpath()
! from Modeling import ModelSet, Model
from Modeling.EditingContext import EditingContext
from Modeling.FetchSpecification import FetchSpecification
***************
*** 435,439 ****
# Initialization of model's caracs.
model=ModelSet.defaultModelSet().modelNamed('StoreEmployees')
! ModelSet.updateModelWithCFG(model, database_cfg)
if reinitDB_flag: reinitDB(); return
--- 435,439 ----
# Initialization of model's caracs.
model=ModelSet.defaultModelSet().modelNamed('StoreEmployees')
! Model.updateModelWithCFG(model, database_cfg)
if reinitDB_flag: reinitDB(); return
Index: test_EditingContext_ParentChild.py
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/tests/test_EditingContext_ParentChild.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** test_EditingContext_ParentChild.py 11 Jun 2003 11:10:20 -0000 1.8
--- test_EditingContext_ParentChild.py 7 Jul 2003 14:57:14 -0000 1.9
***************
*** 18,22 ****
utils.fixpath()
! from Modeling import ModelSet
from Modeling.EditingContext import EditingContext
from Modeling.FetchSpecification import FetchSpecification
--- 18,22 ----
utils.fixpath()
! from Modeling import ModelSet, Model
from Modeling.EditingContext import EditingContext
from Modeling.FetchSpecification import FetchSpecification
***************
*** 534,539 ****
store_employee_model=ModelSet.defaultModelSet().modelNamed('StoreEmployees')
# Initialization of model's caracs.
! ModelSet.updateModelWithCFG(author_books_model, database_cfg)
! ModelSet.updateModelWithCFG(store_employee_model, database_cfg)
# MySQL specifics: change TIMESTAMP to DATETIME
--- 534,539 ----
store_employee_model=ModelSet.defaultModelSet().modelNamed('StoreEmployees')
# Initialization of model's caracs.
! Model.updateModelWithCFG(author_books_model, database_cfg)
! Model.updateModelWithCFG(store_employee_model, database_cfg)
# MySQL specifics: change TIMESTAMP to DATETIME
Index: test_Model.py
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/tests/test_Model.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** test_Model.py 10 Feb 2003 11:32:38 -0000 1.3
--- test_Model.py 7 Jul 2003 14:57:14 -0000 1.4
***************
*** 31,36 ****
from Modeling import Model
class TestModel(unittest.TestCase):
! "Empty for now"
def test_truc(self):
"[Model] Tests that 1 is equal to 1"
--- 31,70 ----
from Modeling import Model
+ class TestModuleFunctions(unittest.TestCase):
+ "Tests for module Model"
+ def checkStoreEmployee(self, model):
+ "Minimum checking of model StoreEmployees"
+ entities=('Store','Employee','Executive','SalesClerk','Mark','Address')
+ self.failIf(len(model.entities()) != len(entities))
+ for e in entities:
+ self.failIf(e not in model.entitiesNames(), "%s not in model"%e)
+
+ def test_01_loadModel(self):
+ "[module Model] loadModel"
+ from Modeling.ModelSet import defaultModelSet
+ self.assertRaises(ImportError, Model.loadModel,
+ 'testPackages/StoreEmployees/does_not_exists.py')
+ self.assertRaises(IOError, Model.loadModel,
+ 'testPackages/StoreEmployees/does_not_exists.xml')
+ self.assertRaises(ValueError, Model.loadModel,
+ 'testPackages/StoreEmployees/Mark.py')
+ # PyModel
+ model=Model.loadModel('testPackages/StoreEmployees/pymodel_StoreEmployees.py')
+ self.failUnless(model)
+ self.failIf(model in defaultModelSet().models())
+ self.checkStoreEmployee(model)
+ # xml-model in .py
+ model=Model.loadModel('testPackages/StoreEmployees/model_StoreEmployees.py')
+ self.failUnless(model)
+ self.failIf(model in defaultModelSet().models())
+ self.checkStoreEmployee(model)
+ # xml-model in .xml
+ model=Model.loadModel('testPackages/StoreEmployees/model_StoreEmployees.xml')
+ self.failUnless(model)
+ self.failIf(model in defaultModelSet().models())
+ self.checkStoreEmployee(model)
+
class TestModel(unittest.TestCase):
! "Tests for class Model. Empty for now"
def test_truc(self):
"[Model] Tests that 1 is equal to 1"
***************
*** 40,43 ****
--- 74,78 ----
def test_suite():
suite = unittest.TestSuite()
+ suite.addTest(unittest.makeSuite(TestModuleFunctions, "test_"))
suite.addTest(unittest.makeSuite(TestModel, "test_"))
return suite
|