Salome HOME
[TetraIntersect] Formatting and including what's inline really inline!
[tools/medcoupling.git] / src / MEDPartitioner_Swig / MEDPartitionerTest.py
index 030759f2d145848c80758b1629964d3e2d44caec..1086d6ee9a1562aeae3dfc15d84d8c6b0fec5485 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2016  CEA/DEN, EDF R&D
+# Copyright (C) 2012-2024  CEA, EDF
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
 from MEDPartitioner import *
 from MEDLoader import *
 import unittest
-from MEDLoaderDataForTest import MEDLoaderDataForTest
+from MEDLoaderDataForTest import MEDLoaderDataForTest,WriteInTmpDir
 
 class MEDPartitionerTest(unittest.TestCase):
+    @WriteInTmpDir
     def testPartition(self):
         fname="PyPartitionTest.med"
         data=MEDLoaderDataForTest.buildACompleteMEDDataStructureWithFieldsOnCells_1()
@@ -38,7 +39,8 @@ class MEDPartitionerTest(unittest.TestCase):
         m1d=data1.getMeshes().getMeshAtPos(0)
         m2d=data2.getMeshes().getMeshAtPos(0)
         self.assertTrue(m1d.isEqual(m2d,1e-12))
-    pass
+        pass
+    @WriteInTmpDir
     def testPartitionGraph(self):
         data=MEDLoaderDataForTest.buildACompleteMEDDataStructureWithFieldsOnCells_1()
         m=data.getMeshes().getMeshAtPos(0)
@@ -47,7 +49,8 @@ class MEDPartitionerTest(unittest.TestCase):
         tool=MEDPartitioner(data,graph)
         data2=tool.getMEDFileData()
         self.assertEqual( 2, data2.getMeshes().getNumberOfMeshes() )
-    pass
+        pass
+    @WriteInTmpDir
     def testPartitionWithJoints(self):
         # cartesian mesh 4x4
         arr=DataArrayDouble(5) ; arr.iota()
@@ -78,7 +81,7 @@ class MEDPartitionerTest(unittest.TestCase):
         self.assertEqual( 2, joints.getJointAtPos(1).getStepAtPos(0).getNumberOfCorrespondences())
         self.assertEqual( 1, joints.getJointAtPos(2).getStepAtPos(0).getNumberOfCorrespondences())
         found=0
-        for ii in xrange(joints.getJointAtPos(0).getStepAtPos(0).getNumberOfCorrespondences()):
+        for ii in range(joints.getJointAtPos(0).getStepAtPos(0).getNumberOfCorrespondences()):
             correspond=joints.getJointAtPos(0).getStepAtPos(0).getCorrespondenceAtPos(ii)
             #VSR (10/05/2016): changed to work with metis 5.1... to be confirmed!
             #if correspond.getCorrespondence().isEqual(DataArrayInt([1,3,2,4])):
@@ -90,6 +93,7 @@ class MEDPartitionerTest(unittest.TestCase):
         pass
         self.assertEqual(1,found)
     pass
+    @WriteInTmpDir
     def testPartitionPartGraph(self):
         arr=DataArrayDouble(5) ; arr.iota()
         c=MEDCouplingCMesh() ; c.setCoords(arr,arr)