[commit] r1982 - in trunk/Tests/GPyUnit: . Regr/Mga Regr/Mga/utils
GMESRC Repository Notifications
gme-commit at list.isis.vanderbilt.edu
Mon Jul 30 13:17:08 CDT 2012
Author: ksmyth
Date: Mon Jul 30 13:17:07 2012
New Revision: 1982
Log:
Run more tests on x64
Modified:
trunk/Tests/GPyUnit/Regr/Mga/tc2.py
trunk/Tests/GPyUnit/Regr/Mga/tc3.py
trunk/Tests/GPyUnit/Regr/Mga/tc4.py
trunk/Tests/GPyUnit/Regr/Mga/tc5.py
trunk/Tests/GPyUnit/Regr/Mga/tc6.py
trunk/Tests/GPyUnit/Regr/Mga/tc7.py
trunk/Tests/GPyUnit/Regr/Mga/utils/Builder.py
trunk/Tests/GPyUnit/__init__.py
Modified: trunk/Tests/GPyUnit/Regr/Mga/tc2.py
==============================================================================
--- trunk/Tests/GPyUnit/Regr/Mga/tc2.py Fri Jul 27 16:17:51 2012 (r1981)
+++ trunk/Tests/GPyUnit/Regr/Mga/tc2.py Mon Jul 30 13:17:07 2012 (r1982)
@@ -5,7 +5,7 @@
import os
import utils.Builder
bd = utils.Builder
-
+from GPyUnit.util import DispatchEx
"""
tests properties of IMgaProject
@@ -15,7 +15,7 @@
def setUp( self ): ## hook method: creates a new mga file all the times, and deletes one if existing
- self.project = win32com.client.DispatchEx("Mga.MgaProject")
+ self.project = DispatchEx("Mga.MgaProject")
self.mganame = "_tc2_all_sf.mga"
Modified: trunk/Tests/GPyUnit/Regr/Mga/tc3.py
==============================================================================
--- trunk/Tests/GPyUnit/Regr/Mga/tc3.py Fri Jul 27 16:17:51 2012 (r1981)
+++ trunk/Tests/GPyUnit/Regr/Mga/tc3.py Mon Jul 30 13:17:07 2012 (r1982)
@@ -4,6 +4,7 @@
import pythoncom
import os
import utils.Builder
+from GPyUnit.util import DispatchEx
bd = utils.Builder
@@ -25,7 +26,7 @@
# this file will be created:
mganame = "_tc3_A_sf.mga"
- project = win32com.client.DispatchEx("Mga.MgaProject")
+ project = DispatchEx("Mga.MgaProject")
try:
project.Create( "MGA=" + mganame, "SF")
@@ -63,7 +64,7 @@
# this file will be created:
mganame = "_tc4_B_sf.mga"
- project = win32com.client.DispatchEx("Mga.MgaProject")
+ project = DispatchEx("Mga.MgaProject")
try:
project.Create( "MGA=" + mganame, "SF")
Modified: trunk/Tests/GPyUnit/Regr/Mga/tc4.py
==============================================================================
--- trunk/Tests/GPyUnit/Regr/Mga/tc4.py Fri Jul 27 16:17:51 2012 (r1981)
+++ trunk/Tests/GPyUnit/Regr/Mga/tc4.py Mon Jul 30 13:17:07 2012 (r1982)
@@ -7,6 +7,7 @@
import utils.Builder
bd = utils.Builder
+from GPyUnit.util import DispatchEx
from GPyUnit.util import dec_disable_early_binding
class TestCase4( unittest.TestCase ):
@@ -481,7 +482,7 @@
par_con2_str = "XML=" + curdir + "used_paradigms\\SF\\SF_older.xmp"
ori_conn_str = "MGA=" + curdir + "used_paradigms\\SF\\SF_orig.mta"
- registrar = win32com.client.Dispatch("Mga.MgaRegistrar")
+ registrar = DispatchEx("Mga.MgaRegistrar")
# 1: user registry
# 2: system registry
@@ -621,7 +622,7 @@
"""
mganame = "_tc4_E2_sf.mga"
- self.project = project = win32com.client.DispatchEx("Mga.MgaProject")
+ self.project = project = DispatchEx("Mga.MgaProject")
charform_guid = self.register_old_sf_par()
Modified: trunk/Tests/GPyUnit/Regr/Mga/tc5.py
==============================================================================
--- trunk/Tests/GPyUnit/Regr/Mga/tc5.py Fri Jul 27 16:17:51 2012 (r1981)
+++ trunk/Tests/GPyUnit/Regr/Mga/tc5.py Mon Jul 30 13:17:07 2012 (r1982)
@@ -6,6 +6,7 @@
import utils.Builder
bd = utils.Builder
+from GPyUnit.util import DispatchEx
from GPyUnit.util import dec_disable_early_binding
class TestCase5( unittest.TestCase ):
Modified: trunk/Tests/GPyUnit/Regr/Mga/tc6.py
==============================================================================
--- trunk/Tests/GPyUnit/Regr/Mga/tc6.py Fri Jul 27 16:17:51 2012 (r1981)
+++ trunk/Tests/GPyUnit/Regr/Mga/tc6.py Mon Jul 30 13:17:07 2012 (r1982)
@@ -7,6 +7,7 @@
import utils.Builder
bd = utils.Builder
+from GPyUnit.util import DispatchEx
from GPyUnit.util import dec_disable_early_binding
class TestCase6( unittest.TestCase ):
Modified: trunk/Tests/GPyUnit/Regr/Mga/tc7.py
==============================================================================
--- trunk/Tests/GPyUnit/Regr/Mga/tc7.py Fri Jul 27 16:17:51 2012 (r1981)
+++ trunk/Tests/GPyUnit/Regr/Mga/tc7.py Mon Jul 30 13:17:07 2012 (r1982)
@@ -6,598 +6,589 @@
import utils.Builder
bd = utils.Builder
+from GPyUnit.util import DispatchEx
class TestCase7( unittest.TestCase ):
+ """
+ avoid if possible the overriding of __init__, yet if you override use the following form:
+ def __init__(self, methodName='runTest'):
+ unittest.TestCase.__init__(self, methodName)
+ """
+
+ project = None
+
+ def setUp( self ): ## hook method
+ pass
+
+ def tearDown( self ): ## hook method
+ if self.project:
+ self.project.Close( 0 )
+ pass
+
+ def findInProj( self, project, obj_name = "", obj_kind = ""):
+ # create a filter
+ filter = project.CreateFilter()
+
+ # use Name filter
+ filter.Name = obj_name
+ filter.Kind = obj_kind
+
+ try:
+ some_fcos = project.AllFCOs( filter )
+ if some_fcos.Count > 0:
+ return some_fcos.Item( 1 )
+ else:
+ print "findInProj >> Object not found : name = '" + obj_name + "' kind = '" + obj_kind + "'"
+ assert 0
+ except:
+ print "findInProj >> Exception : name = '" + obj_name + "' kind = '" + obj_kind + "'"
+ assert 0
+
+ def populate7A(self, p):
+ pri = bd.newObjInFold( p, p.RootFolder, 'Primitive')
+ pri.Name = 'NewPrimitive'
+
+ i1 = bd.new( p, pri, 'InputParameters')
+ i1.Name = 'NewInputParameters'
+
+ i2 = bd.new( p, pri, 'InputSignals')
+ i2.Name = 'NewInputSignals'
+
+ i3 = bd.new( p, pri, 'OutputParameters')
+ i3.Name = 'NewOutputParameters'
+
+ i4 = bd.new( p, pri, 'OutputParameters')
+ i4.Name = 'NewOutputParameters'
+
+ i5 = bd.new( p, pri, 'OutputSignals')
+ i5.Name = 'NewOutputSignals'
+
+ i6 = bd.new( p, pri, 'Parameters')
+ i6.Name = 'NewParameters'
+
+
+ def testA( self ):
+ """ testA
+ test properties of IMgaFCO such as
+ Meta
+ MetaRole
+ ParentModel
+ ParentFolder
"""
- avoid if possible the overriding of __init__, yet if you override use the following form:
- def __init__(self, methodName='runTest'):
- unittest.TestCase.__init__(self, methodName)
- """
+
+ mganame = "_tc7_A_sf.mga"
- def setUp( self ): ## hook method
- pass
+ # create the project with the needed kinds
+ project = bd.creaP( mganame, "SF")
+ if not project:
+ self.fail("Create failed")
+ try:
+ self.populate7A( project)
+ except:
+ bd.saveP( project)
+ raise
+ bd.saveP( project)
+
+
+ # open the created project
+ self.project = project
+ try:
+ project.Open( "MGA=" + mganame )
+ except:
+ project.Close(0)
+ raise
+
+ terr = project.CreateTerritory( None, None, None)
+ trans = project.BeginTransaction( terr)
+
+ to_find = "id-0066-00000002"
+ fco1 = project.GetFCOByID( to_find )
+
+ to_find = "id-0066-00000003"
+ fco3 = project.GetFCOByID( to_find )
+ to_find = "id-0066-00000004"
+ fco4 = project.GetFCOByID( to_find )
+
+ assert fco3.Meta == fco4.Meta
+ metafco3 = fco3.Meta # this line causes win32 exception
+ assert metafco3.Name == "OutputParam"
+
+ assert fco3.MetaRole == fco4.MetaRole
+ metarole3 = fco3.MetaRole # this line causes win32 exception
+ assert metarole3.Name == "OutputParameters"
+
+ mod = fco3.ParentModel
+ par = mod.ParentFolder
+
+ assert par == project.RootFolder
- def tearDown( self ): ## hook method
- self.project.Close( 0 )
- pass
+ # commit trans
+ project.CommitTransaction()
+
- def findInProj( self, project, obj_name = "", obj_kind = ""):
+ project.Save()
+ project.Close(0)
- # create a filter
- filter = project.CreateFilter()
-
- # use Name filter
- filter.Name = obj_name
- filter.Kind = obj_kind
-
- try:
- some_fcos = project.AllFCOs( filter )
- if some_fcos.Count > 0:
- return some_fcos.Item( 1 )
- else:
- print "findInProj >> Object not found : name = '" + obj_name + "' kind = '" + obj_kind + "'"
- assert 0
- except:
- print "findInProj >> Exception : name = '" + obj_name + "' kind = '" + obj_kind + "'"
- assert 0
-
- pass
-
- def populate7A(self, p):
- pri = bd.newObjInFold( p, p.RootFolder, 'Primitive')
- pri.Name = 'NewPrimitive'
-
- i1 = bd.new( p, pri, 'InputParameters')
- i1.Name = 'NewInputParameters'
-
- i2 = bd.new( p, pri, 'InputSignals')
- i2.Name = 'NewInputSignals'
-
- i3 = bd.new( p, pri, 'OutputParameters')
- i3.Name = 'NewOutputParameters'
-
- i4 = bd.new( p, pri, 'OutputParameters')
- i4.Name = 'NewOutputParameters'
-
- i5 = bd.new( p, pri, 'OutputSignals')
- i5.Name = 'NewOutputSignals'
-
- i6 = bd.new( p, pri, 'Parameters')
- i6.Name = 'NewParameters'
-
-
- def testA( self ):
- """ testA
- test properties of IMgaFCO such as
- Meta
- MetaRole
- ParentModel
- ParentFolder
- """
-
- mganame = "_tc7_A_sf.mga"
-
- # create the project with the needed kinds
- project = bd.creaP( mganame, "SF")
- if not project:
- self.fail("Create failed")
- try:
- self.populate7A( project)
- except:
- bd.saveP( project)
- raise
- bd.saveP( project)
-
-
- # open the created project
- self.project = project
- try:
- project.Open( "MGA=" + mganame )
- except:
- project.Close(0)
- raise
-
- terr = project.CreateTerritory( None, None, None)
- trans = project.BeginTransaction( terr)
-
- to_find = "id-0066-00000002"
- fco1 = project.GetFCOByID( to_find )
-
- to_find = "id-0066-00000003"
- fco3 = project.GetFCOByID( to_find )
- to_find = "id-0066-00000004"
- fco4 = project.GetFCOByID( to_find )
-
- assert fco3.Meta == fco4.Meta
- metafco3 = fco3.Meta # this line causes win32 exception
- assert metafco3.Name == "OutputParam"
-
- assert fco3.MetaRole == fco4.MetaRole
- metarole3 = fco3.MetaRole # this line causes win32 exception
- assert metarole3.Name == "OutputParameters"
-
- mod = fco3.ParentModel
- par = mod.ParentFolder
-
- assert par == project.RootFolder
+ def populate7B(self, p):
+ folder1 = bd.newFolder( p, p.RootFolder, 'Folder')
+ folder1.Name = 'NewFolder'
+
+ folder2 = bd.newFolder( p, folder1, 'Folder')
+ folder2.Name = 'NewFolder'
- # commit trans
- project.CommitTransaction()
-
+ folder3 = bd.newFolder( p, folder2, 'Folder')
+ folder3.Name = 'NewFolder'
- project.Save()
- project.Close(0)
+ c1 = bd.newObjInFold( p, folder3, 'Compound')
+ c1.Name = 'NewCompound'
+
+ for i in range(0,7):
+ ci = bd.newObjInFold( p, folder3, 'Compound')
+ ci.Name = 'NewCmp'
+
+ c2 = bd.new( p, c1, 'CompoundParts')
+ c2.Name = 'NewCompoundParts'
+
+ c3 = bd.new( p, c2, 'CompoundParts')
+ c3.Name = 'NewCompoundParts'
+
+ c4 = bd.new( p, c3, 'CompoundParts')
+ c4.Name = 'NewCompoundParts'
+
+ c5 = bd.new( p, c4, 'CompoundParts')
+ c5.Name = 'NewCompoundParts'
+
+ c6 = bd.new( p, c5, 'CompoundParts')
+ c6.Name = 'NewCompoundParts'
+
+ c7 = bd.new( p, c5, 'PrimitiveParts')
+ c7.Name = 'NewPrimitiveParts'
+
+
+ def testB( self ):
+ """ testB
+ test properties of IMgaFCO such as
+ ParentModel
+ ParentFolder
+ """
- pass
+ mganame = "_tc7_B_sf.mga"
- def populate7B(self, p):
- folder1 = bd.newFolder( p, p.RootFolder, 'Folder')
- folder1.Name = 'NewFolder'
-
- folder2 = bd.newFolder( p, folder1, 'Folder')
- folder2.Name = 'NewFolder'
-
- folder3 = bd.newFolder( p, folder2, 'Folder')
- folder3.Name = 'NewFolder'
-
- c1 = bd.newObjInFold( p, folder3, 'Compound')
- c1.Name = 'NewCompound'
-
- for i in range(0,7):
- ci = bd.newObjInFold( p, folder3, 'Compound')
- ci.Name = 'NewCmp'
-
- c2 = bd.new( p, c1, 'CompoundParts')
- c2.Name = 'NewCompoundParts'
-
- c3 = bd.new( p, c2, 'CompoundParts')
- c3.Name = 'NewCompoundParts'
-
- c4 = bd.new( p, c3, 'CompoundParts')
- c4.Name = 'NewCompoundParts'
-
- c5 = bd.new( p, c4, 'CompoundParts')
- c5.Name = 'NewCompoundParts'
-
- c6 = bd.new( p, c5, 'CompoundParts')
- c6.Name = 'NewCompoundParts'
-
- c7 = bd.new( p, c5, 'PrimitiveParts')
- c7.Name = 'NewPrimitiveParts'
-
-
- def testB( self ):
- """ testB
- test properties of IMgaFCO such as
- ParentModel
- ParentFolder
- """
-
- mganame = "_tc7_B_sf.mga"
-
- # create the project with the needed kinds
- project = bd.creaP( mganame, "SF")
- if not project:
- self.fail("Create failed")
- try:
- self.populate7B( project)
- except:
- bd.saveP( project)
- raise
- bd.saveP( project)
-
+ # create the project with the needed kinds
+ project = bd.creaP( mganame, "SF")
+ if not project:
+ self.fail("Create failed")
+ try:
+ self.populate7B( project)
+ except:
+ bd.saveP( project)
+ raise
+ bd.saveP( project)
+
- # open the created project
- self.project = project
- try:
- project.Open( "MGA=" + mganame )
- except:
- project.Close(0)
- raise
+ # open the created project
+ self.project = project
+ try:
+ project.Open( "MGA=" + mganame )
+ except:
+ project.Close(0)
+ raise
-
- terr = project.CreateTerritory( None, None, None)
-
- trans = project.BeginTransaction( terr)
+ terr = project.CreateTerritory( None, None, None)
+
+ trans = project.BeginTransaction( terr)
- to_find = "id-0065-0000000d"
- fco3 = project.GetFCOByID( to_find )
- to_find = "id-0065-0000000e"
- fco4 = project.GetFCOByID( to_find )
-
- last_parent = fco3;
- mod = fco3.ParentModel
- count_model_parents = 0
- while mod != None:
- count_model_parents = 1 + count_model_parents
- last_parent = mod
- mod = mod.ParentModel
-
- assert count_model_parents == 5
+ to_find = "id-0065-0000000d"
+ fco3 = project.GetFCOByID( to_find )
+ to_find = "id-0065-0000000e"
+ fco4 = project.GetFCOByID( to_find )
+
+ last_parent = fco3;
+ mod = fco3.ParentModel
+ count_model_parents = 0
+ while mod != None:
+ count_model_parents = 1 + count_model_parents
+ last_parent = mod
+ mod = mod.ParentModel
+
+ assert count_model_parents == 5
- fol = last_parent.ParentFolder
- count_folder_parents = 0
- while fol != None:
- count_folder_parents = 1 + count_folder_parents
- last_parent = fol
- fol = fol.ParentFolder
-
- assert count_folder_parents == 4
+ fol = last_parent.ParentFolder
+ count_folder_parents = 0
+ while fol != None:
+ count_folder_parents = 1 + count_folder_parents
+ last_parent = fol
+ fol = fol.ParentFolder
+
+ assert count_folder_parents == 4
- assert last_parent == project.RootFolder
+ assert last_parent == project.RootFolder
- # commit trans
- project.CommitTransaction()
-
- project.Save()
- project.Close(0)
+ # commit trans
+ project.CommitTransaction()
+
+ project.Save()
+ project.Close(0)
- pass
+ def populate7C(self, p):
+ folder1 = bd.newFolder( p, p.RootFolder, 'Folder')
+ folder1.Name = 'Samples'
+
+ folder2 = bd.newFolder( p, p.RootFolder, 'Folder')
+ folder2.Name = 'Universe'
- def populate7C(self, p):
- folder1 = bd.newFolder( p, p.RootFolder, 'Folder')
- folder1.Name = 'Samples'
-
- folder2 = bd.newFolder( p, p.RootFolder, 'Folder')
- folder2.Name = 'Universe'
-
- c1 = bd.newObjInFold( p, folder1, 'Compound')
- c1.Name = 'NewCompound'
-
- c2 = bd.newObjInFold( p, folder1, 'Primitive')
- c2.Name = 'NewPrimitive'
-
- c3 = bd.new( p, c1, 'CompoundParts')
- c3.Name = 'NewCompoundParts'
-
- i1 = bd.new( p, c3, 'InputParameters')
- i1.Name = 'NewInputParameters'
-
- i2 = bd.new( p, c3, 'InputSignals')
- i2.Name = 'NewInputSignals'
-
- c4 = bd.newObjInFold( p, folder2, 'Compound')
- c4.Name = 'NewCompound'
-
- c5 = bd.newObjInFold( p, folder2, 'Primitive')
- c5.Name = 'NewPrimitive'
-
- c6 = bd.new( p, c4, 'CompoundParts')
- c6.Name = 'NewCompoundParts'
-
- c7 = bd.new( p, c4, 'PrimitiveParts')
- c7.Name = 'NewPrimitiveParts'
-
- i3 = bd.new( p, c6, 'InputParameters')
- i3.Name = 'NewInputParameters'
-
- i4 = bd.new( p, c6, 'InputParameters')
- i4.Name = 'NewInputParameters'
-
- i5 = bd.new( p, c6, 'InputSignals')
- i5.Name = 'NewInputSignals'
-
- i6 = bd.new( p, c6, 'InputSignals')
- i6.Name = 'NewInputSignals'
-
-
- i7 = bd.new( p, c7, 'InputParameters')
- i7.Name = 'NewInputParameters'
-
- i8 = bd.new( p, c7, 'InputParameters')
- i8.Name = 'NewInputParameters'
-
- i9 = bd.new( p, c7, 'InputSignals')
- i9.Name = 'NewInputSignals'
-
- ia = bd.new( p, c7, 'InputSignals')
- ia.Name = 'NewInputSignals'
-
- ib = bd.new( p, c5, 'InputParameters')
- ib.Name = 'NewInputParameters'
-
- ic = bd.new( p, c5, 'InputSignals')
- ic.Name = 'NewInputSignals'
-
- id = bd.new( p, c5, 'OutputParameters')
- id.Name = 'NewOutputParameters'
-
-
- def testC( self ):
- """ testC
- test properties of IMgaFCO such as
- Part
- Parts
- PartByMetaPart
- """
+ c1 = bd.newObjInFold( p, folder1, 'Compound')
+ c1.Name = 'NewCompound'
+
+ c2 = bd.newObjInFold( p, folder1, 'Primitive')
+ c2.Name = 'NewPrimitive'
+
+ c3 = bd.new( p, c1, 'CompoundParts')
+ c3.Name = 'NewCompoundParts'
+
+ i1 = bd.new( p, c3, 'InputParameters')
+ i1.Name = 'NewInputParameters'
+
+ i2 = bd.new( p, c3, 'InputSignals')
+ i2.Name = 'NewInputSignals'
+
+ c4 = bd.newObjInFold( p, folder2, 'Compound')
+ c4.Name = 'NewCompound'
+
+ c5 = bd.newObjInFold( p, folder2, 'Primitive')
+ c5.Name = 'NewPrimitive'
+
+ c6 = bd.new( p, c4, 'CompoundParts')
+ c6.Name = 'NewCompoundParts'
+
+ c7 = bd.new( p, c4, 'PrimitiveParts')
+ c7.Name = 'NewPrimitiveParts'
+
+ i3 = bd.new( p, c6, 'InputParameters')
+ i3.Name = 'NewInputParameters'
+
+ i4 = bd.new( p, c6, 'InputParameters')
+ i4.Name = 'NewInputParameters'
+
+ i5 = bd.new( p, c6, 'InputSignals')
+ i5.Name = 'NewInputSignals'
+
+ i6 = bd.new( p, c6, 'InputSignals')
+ i6.Name = 'NewInputSignals'
+
+
+ i7 = bd.new( p, c7, 'InputParameters')
+ i7.Name = 'NewInputParameters'
+
+ i8 = bd.new( p, c7, 'InputParameters')
+ i8.Name = 'NewInputParameters'
+
+ i9 = bd.new( p, c7, 'InputSignals')
+ i9.Name = 'NewInputSignals'
+
+ ia = bd.new( p, c7, 'InputSignals')
+ ia.Name = 'NewInputSignals'
+
+ ib = bd.new( p, c5, 'InputParameters')
+ ib.Name = 'NewInputParameters'
+
+ ic = bd.new( p, c5, 'InputSignals')
+ ic.Name = 'NewInputSignals'
+
+ id = bd.new( p, c5, 'OutputParameters')
+ id.Name = 'NewOutputParameters'
+
- mganame = "_tc7_C_sf.mga"
+ def testC( self ):
+ """ testC
+ test properties of IMgaFCO such as
+ Part
+ Parts
+ PartByMetaPart
+ """
+
+ mganame = "_tc7_C_sf.mga"
- # create the project with the needed kinds
- project = bd.creaP( mganame, "SF")
- if not project:
- self.fail("Create failed")
- try:
- self.populate7C( project)
- except:
- bd.saveP( project)
- raise
- bd.saveP( project)
-
+ # create the project with the needed kinds
+ project = bd.creaP( mganame, "SF")
+ if not project:
+ self.fail("Create failed")
+ try:
+ self.populate7C( project)
+ except:
+ bd.saveP( project)
+ raise
+ bd.saveP( project)
+
- # open the created project
- self.project = project
- try:
- project.Open( "MGA=" + mganame )
- except:
- project.Close(0)
- raise
-
+ # open the created project
+ self.project = project
+ try:
+ project.Open( "MGA=" + mganame )
+ except:
+ project.Close(0)
+ raise
- terr = project.CreateTerritory( None, None, None)
-
- trans = project.BeginTransaction( terr)
+ terr = project.CreateTerritory( None, None, None)
+
+ trans = project.BeginTransaction( terr)
- to_find = "id-0066-00000001"
- inpar = project.GetFCOByID( to_find ) # inputparameter
+ to_find = "id-0066-00000001"
+ inpar = project.GetFCOByID( to_find ) # inputparameter
- to_find = "id-0066-00000002"
- insig = project.GetFCOByID( to_find ) # inputsignal
-
- to_find = "id-0065-00000003"
- cp = project.GetFCOByID( to_find ) # newcompoundparts
-
- to_find = "id-0065-00000004"
- pp = project.GetFCOByID( to_find ) # newprimitiveparts
-
- aspect_1 = cp.Meta.AspectByName("ParameterAspect")
- aspect_2 = cp.Meta.AspectByName("SignalFlowAspect")
-
- #
- # tests for insig "InputSignal"
- #
- part = insig.Part( aspect_1)
- assert part == None
-
- part = insig.Part( aspect_2)
- assert part != None
- assert part in insig.Parts
- metapart = part.Meta
- another_part = insig.PartByMetaPart( metapart)
- assert another_part in insig.Parts
- assert another_part == part
- assert another_part.FCO.Name == part.FCO.Name
-
- #
- # tests for inpar "InputParameter"
- #
- part = inpar.Part( aspect_2)
- assert part == None
-
- part = inpar.Part( aspect_1)
- assert part != None
+ to_find = "id-0066-00000002"
+ insig = project.GetFCOByID( to_find ) # inputsignal
+
+ to_find = "id-0065-00000003"
+ cp = project.GetFCOByID( to_find ) # newcompoundparts
+
+ to_find = "id-0065-00000004"
+ pp = project.GetFCOByID( to_find ) # newprimitiveparts
+
+ aspect_1 = cp.Meta.AspectByName("ParameterAspect")
+ aspect_2 = cp.Meta.AspectByName("SignalFlowAspect")
+
+ #
+ # tests for insig "InputSignal"
+ #
+ part = insig.Part( aspect_1)
+ assert part == None
+
+ part = insig.Part( aspect_2)
+ assert part != None
+ assert part in insig.Parts
+ metapart = part.Meta
+ another_part = insig.PartByMetaPart( metapart)
+ assert another_part in insig.Parts
+ assert another_part == part
+ assert another_part.FCO.Name == part.FCO.Name
+
+ #
+ # tests for inpar "InputParameter"
+ #
+ part = inpar.Part( aspect_2)
+ assert part == None
+
+ part = inpar.Part( aspect_1)
+ assert part != None
- assert part in inpar.Parts
+ assert part in inpar.Parts
- metapart = part.Meta
- another_part = inpar.PartByMetaPart( metapart)
- assert another_part in inpar.Parts
- assert another_part == part
- assert another_part.FCO.Name == part.FCO.Name
-
- # commit trans
- project.CommitTransaction()
-
+ metapart = part.Meta
+ another_part = inpar.PartByMetaPart( metapart)
+ assert another_part in inpar.Parts
+ assert another_part == part
+ assert another_part.FCO.Name == part.FCO.Name
+
+ # commit trans
+ project.CommitTransaction()
+
- project.Save()
- project.Close(0)
+ project.Save()
+ project.Close(0)
- pass
+ def populate7D(self, p):
+ c1 = bd.newObjInFold( p, p.RootFolder, 'Compound')
+ c1.Name = 'NewCompound'
+
+ p1 = bd.new( p, c1, 'PrimitiveParts')
+ p1.Name = 'NewPrimitiveParts'
+
+ ip1 = bd.new( p, p1, 'InputParameters')
+ ip1.Name = 'NewInputParameters'
+
- def populate7D(self, p):
- c1 = bd.newObjInFold( p, p.RootFolder, 'Compound')
- c1.Name = 'NewCompound'
-
- p1 = bd.new( p, c1, 'PrimitiveParts')
- p1.Name = 'NewPrimitiveParts'
-
- ip1 = bd.new( p, p1, 'InputParameters')
- ip1.Name = 'NewInputParameters'
-
-
- def testD( self ):
- """ testD
- test properties of IMgaFCO such as
- AttributeByName -get/put
- StrAttrByName -get/put
- IntAttrByName -get/put
-
- first inquire the original values, then modify them
- inquire once again, revert back to the original ones
- then modify and inquire once again using the variant put/getter AttributeByName
- """
-
- mganame = "_tc7_D_sf.mga"
-
- # create the project with the needed kinds
- project = bd.creaP( mganame, "SF")
- if not project:
- self.fail("Create failed")
- try:
- self.populate7D( project)
- except:
- bd.saveP( project)
- raise
- bd.saveP( project)
-
+ def testD( self ):
+ """ testD
+ test properties of IMgaFCO such as
+ AttributeByName -get/put
+ StrAttrByName -get/put
+ IntAttrByName -get/put
- # open the created project
- self.project = project
- try:
- project.Open( "MGA=" + mganame )
- except:
- project.Close(0)
- raise
+ first inquire the original values, then modify them
+ inquire once again, revert back to the original ones
+ then modify and inquire once again using the variant put/getter AttributeByName
+ """
+
+ mganame = "_tc7_D_sf.mga"
+ # create the project with the needed kinds
+ project = bd.creaP( mganame, "SF")
+ if not project:
+ self.fail("Create failed")
+ try:
+ self.populate7D( project)
+ except:
+ bd.saveP( project)
+ raise
+ bd.saveP( project)
+
- terr = project.CreateTerritory( None, None, None)
-
- trans = project.BeginTransaction( terr)
+ # open the created project
+ self.project = project
+ try:
+ project.Open( "MGA=" + mganame )
+ except:
+ project.Close(0)
+ raise
- to_find = "id-0066-00000001"
- ip = project.GetFCOByID( to_find ) # inputparameter
-
- to_find = "id-0065-00000002"
- pp = project.GetFCOByID( to_find ) # newprimitiveparts
-
- aspect_1 = pp.Meta.AspectByName("ParameterAspect")
- aspect_2 = pp.Meta.AspectByName("SignalFlowAspect")
-
- assert 1 == ip.GetIntAttrByNameDisp( "Size" ) # default value
- assert "Integer" == ip.GetStrAttrByNameDisp( "DataType" ) # default value
-
- # modify attributes
- ip.SetIntAttrByNameDisp( "Size", 2)
- ip.SetStrAttrByNameDisp( "DataType", "Double")
-
- assert 2 == ip.GetIntAttrByNameDisp( "Size" )
- assert "Double" == ip.GetStrAttrByNameDisp( "DataType" )
-
- # revert changes
- ip.SetIntAttrByNameDisp( "Size", 1)
- ip.SetStrAttrByNameDisp( "DataType", "Integer")
-
- assert 10 == pp.GetIntAttrByNameDisp( "Priority" )
- assert "" == pp.GetStrAttrByNameDisp( "Script" )
- assert "IFALL" == pp.GetStrAttrByNameDisp( "Firing" )
-
- # modify
- pp.SetIntAttrByNameDisp( "Priority", 5 )
- d_s = "int dummy_script()\n{ return 1; }"
- pp.SetStrAttrByNameDisp( "Script", d_s)
- pp.SetStrAttrByNameDisp( "Firing", "IFANY" )
-
- assert 5 == pp.GetIntAttrByNameDisp( "Priority" )
- assert d_s == pp.GetStrAttrByNameDisp( "Script" )
- assert "IFANY" == pp.GetStrAttrByNameDisp( "Firing" )
-
- # test whether VARIANTS are returning back the values
- pr = 0 # integer
- pr = pp.GetAttributeByNameDisp( "Priority")
- assert pr == 5
-
- scr = ""
- scr = pp.GetAttributeByNameDisp( "Script" )
- assert scr == d_s
-
- fir = "IFALL"
- fir = pp.GetAttributeByNameDisp( "Firing" )
- assert "IFANY" == fir
-
- # revert changes using AttributeByName (test whether VARIANTS are interpreted all right)
- old_pr_val = 10
- pp.SetAttributeByNameDisp( "Priority", old_pr_val )
+ terr = project.CreateTerritory( None, None, None)
+
+ trans = project.BeginTransaction( terr)
- old_scr_val = ""
- pp.SetAttributeByNameDisp( "Script", old_scr_val )
-
- old_fir_val = "IFALL"
- pp.SetAttributeByNameDisp( "Firing", old_fir_val )
-
- # the values must be the original ones
- assert 10 == pp.GetIntAttrByNameDisp( "Priority")
- assert "" == pp.GetStrAttrByNameDisp( "Script")
- assert "IFALL" == pp.GetStrAttrByNameDisp( "Firing")
+ to_find = "id-0066-00000001"
+ ip = project.GetFCOByID( to_find ) # inputparameter
+
+ to_find = "id-0065-00000002"
+ pp = project.GetFCOByID( to_find ) # newprimitiveparts
+
+ aspect_1 = pp.Meta.AspectByName("ParameterAspect")
+ aspect_2 = pp.Meta.AspectByName("SignalFlowAspect")
+
+ assert 1 == ip.GetIntAttrByNameDisp( "Size" ) # default value
+ assert "Integer" == ip.GetStrAttrByNameDisp( "DataType" ) # default value
+
+ # modify attributes
+ ip.SetIntAttrByNameDisp( "Size", 2)
+ ip.SetStrAttrByNameDisp( "DataType", "Double")
+
+ assert 2 == ip.GetIntAttrByNameDisp( "Size" )
+ assert "Double" == ip.GetStrAttrByNameDisp( "DataType" )
+
+ # revert changes
+ ip.SetIntAttrByNameDisp( "Size", 1)
+ ip.SetStrAttrByNameDisp( "DataType", "Integer")
+
+ assert 10 == pp.GetIntAttrByNameDisp( "Priority" )
+ assert "" == pp.GetStrAttrByNameDisp( "Script" )
+ assert "IFALL" == pp.GetStrAttrByNameDisp( "Firing" )
+
+ # modify
+ pp.SetIntAttrByNameDisp( "Priority", 5 )
+ d_s = "int dummy_script()\n{ return 1; }"
+ pp.SetStrAttrByNameDisp( "Script", d_s)
+ pp.SetStrAttrByNameDisp( "Firing", "IFANY" )
+
+ assert 5 == pp.GetIntAttrByNameDisp( "Priority" )
+ assert d_s == pp.GetStrAttrByNameDisp( "Script" )
+ assert "IFANY" == pp.GetStrAttrByNameDisp( "Firing" )
+
+ # test whether VARIANTS are returning back the values
+ pr = 0 # integer
+ pr = pp.GetAttributeByNameDisp( "Priority")
+ assert pr == 5
+
+ scr = ""
+ scr = pp.GetAttributeByNameDisp( "Script" )
+ assert scr == d_s
+
+ fir = "IFALL"
+ fir = pp.GetAttributeByNameDisp( "Firing" )
+ assert "IFANY" == fir
+
+ # revert changes using AttributeByName (test whether VARIANTS are interpreted all right)
+ old_pr_val = 10
+ pp.SetAttributeByNameDisp( "Priority", old_pr_val )
- # commit trans
- project.CommitTransaction()
-
- project.Save()
- project.Close(0)
+ old_scr_val = ""
+ pp.SetAttributeByNameDisp( "Script", old_scr_val )
+
+ old_fir_val = "IFALL"
+ pp.SetAttributeByNameDisp( "Firing", old_fir_val )
+
+ # the values must be the original ones
+ assert 10 == pp.GetIntAttrByNameDisp( "Priority")
+ assert "" == pp.GetStrAttrByNameDisp( "Script")
+ assert "IFALL" == pp.GetStrAttrByNameDisp( "Firing")
- pass
- def populate7F(self, p):
- f = bd.newObjInFold( p, p.RootFolder, 'NewModel')
- f.Name = 'NewNewModel'
-
- a = bd.new( p, f, 'NewAtom')
- a.Name = 'NewNewAtom'
-
- def testF( self ):
- """ testF
- test properties of IMgaFCO such as
- AttributeByName -get/put
- FloatAttrByName -get/put
- ClearAttrByName
-
- test put/get methods on double type FieldAttributes on a custom (FloatAttr) paradigm
- """
-
- mganame = "_tc7_F_fl.mga"
-
- # create the project with the needed kinds
- project = bd.creaP( mganame, "FloatAttr")
- if not project:
- self.fail("Create failed")
- try:
- self.populate7F( project)
- except:
- bd.saveP( project)
- raise
- bd.saveP( project)
-
- # open the created project
- self.project = project
- try:
- project.Open( "MGA=" + mganame )
- except:
- project.Close(0)
- raise
+ # commit trans
+ project.CommitTransaction()
+
+ project.Save()
+ project.Close(0)
- terr = project.CreateTerritory( None, None, None)
-
- trans = project.BeginTransaction( terr)
+ def populate7F(self, p):
+ f = bd.newObjInFold( p, p.RootFolder, 'NewModel')
+ f.Name = 'NewNewModel'
+
+ a = bd.new( p, f, 'NewAtom')
+ a.Name = 'NewNewAtom'
- to_find = "NewNewAtom"
- at = self.findInProj( project, to_find)
+ def _notworking_testF( self ):
+ """ testF
+ test properties of IMgaFCO such as
+ AttributeByName -get/put
+ FloatAttrByName -get/put
+ ClearAttrByName
+
+ test put/get methods on double type FieldAttributes on a custom (FloatAttr) paradigm
+ """
- try:
- nnnname = at.Name
- except:
- print "Caught 1"
- assert 0
-
-
- assert 0.000 == at.GetFloatAttrByNameDisp( "Float1" ) # default value
- assert 1.001 == at.GetFloatAttrByNameDisp( "Float2" ) # default value
-
- at.SetFloatAttrByNameDisp( "Float1", 2.002 )
- at.SetFloatAttrByNameDisp( "Float2", 3.003 )
-
- assert 2.002 == at.GetFloatAttrByNameDisp( "Float1" )
- assert 3.003 == at.GetFloatAttrByNameDisp( "Float2" )
+ mganame = "_tc7_F_fl.mga"
- at.SetAttributeByNameDisp( "Float1", -4.004 )
- at.SetAttributeByNameDisp( "Float2", -5.005 )
-
- # test whether VARIANTS are returning back good values
- assert -4.004 == at.GetAttributeByNameDisp( "Float1" )
- assert -5.005 == at.GetAttributeByNameDisp( "Float2" )
-
- # reset the attribute to its default value and to its unset state
- at.ClearAttrByName( "Float1" )
- at.ClearAttrByName( "Float2" )
+ # create the project with the needed kinds
+ project = bd.creaP( mganame, "FloatAttr")
+ if not project:
+ self.fail("Create failed")
+ try:
+ self.populate7F( project)
+ except:
+ bd.saveP( project)
+ raise
+ bd.saveP( project)
+
+ # open the created project
+ self.project = project
+ try:
+ project.Open( "MGA=" + mganame )
+ except:
+ project.Close(0)
+ raise
- assert 0.000 == at.GetFloatAttrByNameDisp( "Float1" ) # default value
- assert 1.001 == at.GetFloatAttrByNameDisp( "Float2" ) # default value
+ terr = project.CreateTerritory( None, None, None)
+
+ trans = project.BeginTransaction( terr)
- # commit trans
- project.CommitTransaction()
-
- project.Save()
- project.Close(0)
+ to_find = "NewNewAtom"
+ at = self.findInProj( project, to_find)
+
+ try:
+ nnnname = at.Name
+ except:
+ print "Caught 1"
+ assert 0
+
+
+ assert 0.000 == at.GetFloatAttrByNameDisp( "Float1" ) # default value
+ assert 1.001 == at.GetFloatAttrByNameDisp( "Float2" ) # default value
+
+ at.SetFloatAttrByNameDisp( "Float1", 2.002 )
+ at.SetFloatAttrByNameDisp( "Float2", 3.003 )
+
+ assert 2.002 == at.GetFloatAttrByNameDisp( "Float1" )
+ assert 3.003 == at.GetFloatAttrByNameDisp( "Float2" )
+
+ at.SetAttributeByNameDisp( "Float1", -4.004 )
+ at.SetAttributeByNameDisp( "Float2", -5.005 )
+
+ # test whether VARIANTS are returning back good values
+ assert -4.004 == at.GetAttributeByNameDisp( "Float1" )
+ assert -5.005 == at.GetAttributeByNameDisp( "Float2" )
+
+ # reset the attribute to its default value and to its unset state
+ at.ClearAttrByName( "Float1" )
+ at.ClearAttrByName( "Float2" )
+
+ assert 0.000 == at.GetFloatAttrByNameDisp( "Float1" ) # default value
+ assert 1.001 == at.GetFloatAttrByNameDisp( "Float2" ) # default value
+
+ # commit trans
+ project.CommitTransaction()
+
+ project.Save()
+ project.Close(0)
- pass
+ pass
"""
Let's produce the test suites
@@ -625,25 +616,25 @@
# main
########
if __name__ == "__main__":
- print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
- print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
- print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
- print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
- print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
- print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ TEST BEGINS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
- print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
- print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
- print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
- print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
- print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
-
- ######## 1st way
- unittest.main()
-
- ######## 2nd way
- # unittest.main(defaultTest='TestCase7')
-
- ######## 3rd way
- # all = suites3()
- # runner = unittest.TextTestRunner()
- # runner.run( all )
+ print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
+ print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
+ print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
+ print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
+ print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
+ print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ TEST BEGINS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
+ print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
+ print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
+ print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
+ print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
+ print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
+
+ ######## 1st way
+ unittest.main()
+
+ ######## 2nd way
+ # unittest.main(defaultTest='TestCase7')
+
+ ######## 3rd way
+ # all = suites3()
+ # runner = unittest.TextTestRunner()
+ # runner.run( all )
Modified: trunk/Tests/GPyUnit/Regr/Mga/utils/Builder.py
==============================================================================
--- trunk/Tests/GPyUnit/Regr/Mga/utils/Builder.py Fri Jul 27 16:17:51 2012 (r1981)
+++ trunk/Tests/GPyUnit/Regr/Mga/utils/Builder.py Mon Jul 30 13:17:07 2012 (r1982)
@@ -1,6 +1,7 @@
import unittest
import win32com.client
import os
+from GPyUnit.util import DispatchEx
def findInProj( project, obj_name = "", obj_kind = ""):
""" Returns an object in project, satisfying the obj_name and obj_kind criteria, if speficied
@@ -93,7 +94,7 @@
def connect(p, cont, s, d, role_str):
""" Helper method connecting plain fcos/ports, when no references are involved
"""
- z0 = win32com.client.DispatchEx("Mga.MgaFCOs")
+ z0 = DispatchEx("Mga.MgaFCOs")
return cont.CreateSimpleConn( role(p, cont, role_str), s, d, z0, z0)
def connectRefP(p, cont, s, d, r1, r2, role_str):
@@ -104,8 +105,8 @@
r2: modelreference, 'containing' d
r1 or r2 might be 0, when that end of the connection is an fco or modelport (no reference involved)
"""
- z1 = win32com.client.DispatchEx("Mga.MgaFCOs")
- z2 = win32com.client.DispatchEx("Mga.MgaFCOs")
+ z1 = DispatchEx("Mga.MgaFCOs")
+ z2 = DispatchEx("Mga.MgaFCOs")
if r1:
z1.Append( r1)
if r2:
@@ -116,7 +117,7 @@
def creaP(mganame, parad):
from GPyUnit import util
util.register_xmp(parad)
- project = win32com.client.DispatchEx("Mga.MgaProject")
+ project = DispatchEx("Mga.MgaProject")
# may delete old file if exists
# if os.path.isfile( mganame):
Modified: trunk/Tests/GPyUnit/__init__.py
==============================================================================
--- trunk/Tests/GPyUnit/__init__.py Fri Jul 27 16:17:51 2012 (r1981)
+++ trunk/Tests/GPyUnit/__init__.py Mon Jul 30 13:17:07 2012 (r1982)
@@ -31,19 +31,15 @@
'GME_371',
'GME_391',
'test_MetaInterpreter',
+ 'Regr.Mga.tc1',
]
- import GPyUnit.util
- if not GPyUnit.util._opts.Dispatch_x64:
+ if platform.system() != 'Java':
_test_names += [
- 'Regr.Mga.tc1',
+ 'Regr.Mga.tc2',
+ 'Regr.Mga.tc3',
+ 'Regr.Mga.tc5',
+ 'Regr.Mga.tc6',
]
- if platform.system() != 'Java':
- _test_names += [
- 'Regr.Mga.tc2',
- 'Regr.Mga.tc3',
- 'Regr.Mga.tc5',
- 'Regr.Mga.tc6',
- ]
return _test_names
def _tests():
More information about the gme-commit
mailing list