[MOAB-dev] r2975 - in MOAB/trunk/tools/iMesh/python: doc test

jvporter at wisc.edu jvporter at wisc.edu
Thu Jul 2 01:24:02 CDT 2009


Author: jvporter
Date: 2009-07-02 01:24:01 -0500 (Thu, 02 Jul 2009)
New Revision: 2975

Added:
   MOAB/trunk/tools/iMesh/python/test/__init__.py
Removed:
   MOAB/trunk/tools/iMesh/python/test/all.py
Modified:
   MOAB/trunk/tools/iMesh/python/doc/imesh.rst
   MOAB/trunk/tools/iMesh/python/test/adj.py
   MOAB/trunk/tools/iMesh/python/test/basic.py
   MOAB/trunk/tools/iMesh/python/test/entset.py
Log:
* Fix typos in PyTAPS documentation
* Fix test suite not running properly (read: at all)
* Add tests for alternate rootSet method calls


Modified: MOAB/trunk/tools/iMesh/python/doc/imesh.rst
===================================================================
--- MOAB/trunk/tools/iMesh/python/doc/imesh.rst	2009-06-30 23:11:38 UTC (rev 2974)
+++ MOAB/trunk/tools/iMesh/python/doc/imesh.rst	2009-07-02 06:24:01 UTC (rev 2975)
@@ -217,11 +217,11 @@
 In addition to the methods listed above, :class:`Mesh` automatically forwards
 method calls to the root :class:`EntitySet`. Thus, ::
 
-  mesh.getEntities(iBase.type.all, iMesh.topology.all)
+  mesh.getEntities(iBase.Type.all, iMesh.Topology.all)
 
 is equivalent to::
 
-  mesh.rootSet.getEntities(iBase.type.all, iMesh.topology.all)
+  mesh.rootSet.getEntities(iBase.Type.all, iMesh.Topology.all)
 
 EntitySet
 =========

Added: MOAB/trunk/tools/iMesh/python/test/__init__.py
===================================================================
--- MOAB/trunk/tools/iMesh/python/test/__init__.py	                        (rev 0)
+++ MOAB/trunk/tools/iMesh/python/test/__init__.py	2009-07-02 06:24:01 UTC (rev 2975)
@@ -0,0 +1 @@
+__all__ = ['adj', 'basic', 'entset', 'iter', 'tags']

Modified: MOAB/trunk/tools/iMesh/python/test/adj.py
===================================================================
--- MOAB/trunk/tools/iMesh/python/test/adj.py	2009-06-30 23:11:38 UTC (rev 2974)
+++ MOAB/trunk/tools/iMesh/python/test/adj.py	2009-07-02 06:24:01 UTC (rev 2975)
@@ -16,36 +16,28 @@
             self.mesh.createEnt(topo.line_segment, self.ents[2:4] )[0],
             self.mesh.createEnt(topo.line_segment, self.ents[::-3])[0] ]
 
-    def tearDown(self):
-        self.mesh  = None
-        self.verts = None
-        self.ents  = None
-        self.root  = None
-        self.lines = None
-
     def testSquare(self):
         quad = self.mesh.createEnt(topo.quadrilateral, self.lines)[0]
-        root = self.mesh.rootSet
 
-        self.assertEqual(root.getNumOfType(iBase.Type.vertex),  4)
-        self.assertEqual(root.getNumOfType(iBase.Type.edge),    4)
-        self.assertEqual(root.getNumOfType(iBase.Type.face),    1)
+        self.assertEqual(self.mesh.getNumOfType(iBase.Type.vertex),  4)
+        self.assertEqual(self.mesh.getNumOfType(iBase.Type.edge),    4)
+        self.assertEqual(self.mesh.getNumOfType(iBase.Type.face),    1)
 
-        self.assertEqual(root.getNumOfTopo(topo.point),         4)
-        self.assertEqual(root.getNumOfTopo(topo.line_segment),  4)
-        self.assertEqual(root.getNumOfTopo(topo.quadrilateral), 1)
+        self.assertEqual(self.mesh.getNumOfTopo(topo.point),         4)
+        self.assertEqual(self.mesh.getNumOfTopo(topo.line_segment),  4)
+        self.assertEqual(self.mesh.getNumOfTopo(topo.quadrilateral), 1)
 
         self.mesh.deleteEnt(quad)
-        self.assertEqual(root.getNumOfType(iBase.Type.face),    0)
-        self.assertEqual(root.getNumOfTopo(topo.quadrilateral), 0)
+        self.assertEqual(self.mesh.getNumOfType(iBase.Type.face),    0)
+        self.assertEqual(self.mesh.getNumOfTopo(topo.quadrilateral), 0)
 
         self.mesh.deleteEnt(self.lines)
-        self.assertEqual(root.getNumOfType(iBase.Type.edge),    0)
-        self.assertEqual(root.getNumOfTopo(topo.line_segment),  0)
+        self.assertEqual(self.mesh.getNumOfType(iBase.Type.edge),    0)
+        self.assertEqual(self.mesh.getNumOfTopo(topo.line_segment),  0)
 
         self.mesh.deleteEnt(self.ents)
-        self.assertEqual(root.getNumOfType(iBase.Type.vertex),  0)
-        self.assertEqual(root.getNumOfTopo(topo.point),         0)
+        self.assertEqual(self.mesh.getNumOfType(iBase.Type.vertex),  0)
+        self.assertEqual(self.mesh.getNumOfTopo(topo.point),         0)
 
     def testAdj(self):
         adj = self.mesh.getEntAdj(self.ents[1], iBase.Type.all)

Deleted: MOAB/trunk/tools/iMesh/python/test/all.py
===================================================================
--- MOAB/trunk/tools/iMesh/python/test/all.py	2009-06-30 23:11:38 UTC (rev 2974)
+++ MOAB/trunk/tools/iMesh/python/test/all.py	2009-07-02 06:24:01 UTC (rev 2975)
@@ -1,5 +0,0 @@
-import basic
-import entset
-import tags
-import adj
-import iter

Modified: MOAB/trunk/tools/iMesh/python/test/basic.py
===================================================================
--- MOAB/trunk/tools/iMesh/python/test/basic.py	2009-06-30 23:11:38 UTC (rev 2974)
+++ MOAB/trunk/tools/iMesh/python/test/basic.py	2009-07-02 06:24:01 UTC (rev 2975)
@@ -12,8 +12,12 @@
         mesh.dfltStorage
 
         self.assert_(mesh.areEHValid(True))
+
+        self.assertEqual(mesh.getNumOfType(iBase.Type.all),     0)
         self.assertEqual(root.getNumOfType(iBase.Type.all),     0)
+        self.assertEqual(mesh.getNumOfTopo(iMesh.Topology.all), 0)
         self.assertEqual(root.getNumOfTopo(iMesh.Topology.all), 0)
+
         self.assertEqual(mesh.adjTable.shape, (4,4))
 
     def testVertex(self):
@@ -21,7 +25,9 @@
         ent = mesh.createVtx([1,2,3])
         root = mesh.rootSet
 
+        self.assertEqual(mesh.getNumOfType(iBase.Type.vertex),    1)
         self.assertEqual(root.getNumOfType(iBase.Type.vertex),    1)
+        self.assertEqual(mesh.getNumOfTopo(iMesh.Topology.point), 1)
         self.assertEqual(root.getNumOfTopo(iMesh.Topology.point), 1)
 
         self.assert_( (mesh.getVtxCoords(ent) == [1,2,3]).all() )
@@ -40,7 +46,9 @@
         ents = mesh.createVtx(verts, iBase.StorageOrder.interleaved)
         root = mesh.rootSet
 
+        self.assertEqual(mesh.getNumOfType(iBase.Type.vertex),    4)
         self.assertEqual(root.getNumOfType(iBase.Type.vertex),    4)
+        self.assertEqual(mesh.getNumOfTopo(iMesh.Topology.point), 4)
         self.assertEqual(root.getNumOfTopo(iMesh.Topology.point), 4)
 
         coords = mesh.getVtxCoords(ents, iBase.StorageOrder.interleaved)
@@ -67,10 +75,14 @@
         topo = iMesh.Topology
 
         lines = mesh.createEntArr(topo.line_segment,ents)[0]
+        self.assertEqual(mesh.getNumOfType(iBase.Type.vertex),  4)
         self.assertEqual(root.getNumOfType(iBase.Type.vertex),  4)
+        self.assertEqual(mesh.getNumOfType(iBase.Type.edge),    2)
         self.assertEqual(root.getNumOfType(iBase.Type.edge),    2)
 
+        self.assertEqual(mesh.getNumOfTopo(topo.point),         4)
         self.assertEqual(root.getNumOfTopo(topo.point),         4)
+        self.assertEqual(mesh.getNumOfTopo(topo.line_segment),  2)
         self.assertEqual(root.getNumOfTopo(topo.line_segment),  2)
 
     def testSave(self):
@@ -86,8 +98,12 @@
         root = mesh.rootSet
         mesh.load(file.name)
         ents = root.getEntities(iBase.Type.all, iMesh.Topology.all)
+        self.assertEqual(ents.tolist(), mesh.getEntities(iBase.Type.all,
+            iMesh.Topology.all).tolist())
 
+        self.assertEqual(mesh.getNumOfType(iBase.Type.vertex),    1)
         self.assertEqual(root.getNumOfType(iBase.Type.vertex),    1)
+        self.assertEqual(mesh.getNumOfTopo(iMesh.Topology.point), 1)
         self.assertEqual(root.getNumOfTopo(iMesh.Topology.point), 1)
 
         coords = mesh.getVtxCoords(ents, iBase.StorageOrder.interleaved)
@@ -106,8 +122,12 @@
         root = mesh.rootSet
         root.load(file.name)
         ents = root.getEntities(iBase.Type.all, iMesh.Topology.all)
+        self.assertEqual(ents.tolist(), mesh.getEntities(iBase.Type.all,
+            iMesh.Topology.all).tolist())
 
+        self.assertEqual(mesh.getNumOfType(iBase.Type.vertex),    1)
         self.assertEqual(root.getNumOfType(iBase.Type.vertex),    1)
+        self.assertEqual(mesh.getNumOfTopo(iMesh.Topology.point), 1)
         self.assertEqual(root.getNumOfTopo(iMesh.Topology.point), 1)
 
         coords = mesh.getVtxCoords(ents, iBase.StorageOrder.interleaved)

Modified: MOAB/trunk/tools/iMesh/python/test/entset.py
===================================================================
--- MOAB/trunk/tools/iMesh/python/test/entset.py	2009-06-30 23:11:38 UTC (rev 2974)
+++ MOAB/trunk/tools/iMesh/python/test/entset.py	2009-07-02 06:24:01 UTC (rev 2975)
@@ -13,12 +13,15 @@
         self.assertEqual(self.set.instance, self.mesh)
         self.assertEqual(self.set.isList, True)
         self.assertEqual(self.set.getNumEntSets(1), 0)
+        self.assertEqual(self.mesh.getNumEntSets(0), 1)
         self.assertEqual(self.mesh.rootSet.getNumEntSets(0), 1)
 
-        foo = self.mesh.rootSet.getEntSets(0)[0]
-        self.assertEqual(self.set, foo)
+        my_set = self.mesh.getEntSets(0)[0]
+        self.assertEqual(my_set, self.mesh.rootSet.getEntSets(0)[0])
+        self.assertEqual(self.set, my_set)
 
         self.mesh.destroyEntSet(self.set)
+        self.assertEqual(self.mesh.getNumEntSets(0), 0)
         self.assertEqual(self.mesh.rootSet.getNumEntSets(0), 0)
 
     def testEnt(self):



More information about the moab-dev mailing list