Salome HOME
Deal with pipes
[tools/medcoupling.git] / src / PyWrapping / TestPyWrapGathered_medcoupling.py
index 899823638289c34d4e0eafe9230336da778230ed..79a2b6d18ca9a92dbbee5ecfad6ece73086091ed 100644 (file)
@@ -48,6 +48,15 @@ class FileCreator(object):
         pass
         
 class medcouplingTest(unittest.TestCase):
+
+    def test0(self):
+        """ Unconditional test : medcoupling "kernel" classes """
+        f=MEDCouplingFieldDouble(ON_CELLS)
+        g=DataArrayDouble(10,2)
+        h=MEDCouplingUMesh("mesh",3)
+        hh=MEDCouplingRemapper()
+        ee=InterpKernelException("ee")
+        pass
     
     @unittest.skipUnless(HasMEDFileExt(),"Requires link to MED file")
     def test1(self):
@@ -86,7 +95,41 @@ class medcouplingTest(unittest.TestCase):
 
     @unittest.skipUnless(HasPartitionerExt(),"Requires Partitioner activation")
     def test3(self):
-        algoSelected=eval("Graph.%s"%MEDPartitioner.AvailableAlgorithms()[0].upper())
+        for alg in MEDPartitioner.AvailableAlgorithms():
+            st="Graph.%s"%alg.upper()
+            print(st)
+            self.partitionerTesterHelper(eval(st))
+            pass
+        pass
+    
+    @unittest.skipUnless(HasParallelInterpolatorExt(),"Requires // interpolator activated")
+    def test4(self):
+        interface=CommInterface()
+        pass
+
+    @unittest.skipUnless(HasMEDFileExt(),"Requires link to MED file")
+    def test5(self):
+        f=MEDCouplingFieldDouble(ON_NODES)
+        f.setTime(1.25,3,6)
+        a,b,c=f.getTime()
+        self.assertEqual(b,3) ; self.assertEqual(c,6) ; self.assertAlmostEqual(a,1.25,14);
+        f1ts=MEDFileField1TS()
+        f1ts.setTime(10,13,10.75)
+        f.copyTimeInfoFrom(f1ts)
+        a,b,c=f.getTime()
+        self.assertEqual(b,10) ; self.assertEqual(c,13) ; self.assertAlmostEqual(a,10.75,14);
+        f2=MEDCouplingFieldInt(ON_NODES)
+        f2.copyTimeInfoFrom(f1ts)
+        a,b,c=f2.getTime()
+        self.assertEqual(b,10) ; self.assertEqual(c,13) ; self.assertAlmostEqual(a,10.75,14);
+        f3=MEDCouplingFieldFloat(ON_NODES)
+        f3.copyTimeInfoFrom(f1ts)
+        a,b,c=f3.getTime()
+        self.assertEqual(b,10) ; self.assertEqual(c,13) ; self.assertAlmostEqual(a,10.75,14);
+        pass
+        
+
+    def partitionerTesterHelper(self,algoSelected):
         arr=DataArrayDouble(10) ; arr.iota()
         m=MEDCouplingCMesh() ; m.setCoords(arr,arr)
         m=m.buildUnstructured() ; m.setName("mesh")
@@ -98,11 +141,6 @@ class medcouplingTest(unittest.TestCase):
         m0=m[procIdOnCells.findIdsEqual(0)] ; m0.setName("m0")
         pass
     
-    @unittest.skipUnless(HasParallelInterpolatorExt(),"Requires // interpolator activated")
-    def test4(self):
-        interface=CommInterface()
-        pass
-    
     pass
 
 if __name__ == "__main__":