Salome HOME
Update tests for Fedora-24 and Ubuntu-16.04
[tools/medcoupling.git] / src / MEDCoupling_Swig / MEDCouplingPickleTest.py
index 4b954c468b64f978574aac277c3f97a70da853ae..a34420d8a2580c073fe36a85ef08efefc77d9f96 100644 (file)
@@ -1,5 +1,5 @@
 #  -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2015  CEA/DEN, EDF R&D
+# Copyright (C) 2007-2016  CEA/DEN, EDF R&D
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -271,7 +271,7 @@ class MEDCouplingPickleTest(unittest.TestCase):
         tmpIds=f.getCellIdsHavingGaussLocalization(0);
         self.assertEqual(ids2,list(tmpIds.getValues()));
         self.assertRaises(InterpKernelException,f.checkConsistencyLight);#<- it's always not ok because undelying array not with the good size.
-        array2=f.getArray().substr(0,10);
+        array2=f.getArray().subArray(0,10);
         f.setArray(array2);
         f.checkConsistencyLight();
         ####
@@ -292,6 +292,20 @@ class MEDCouplingPickleTest(unittest.TestCase):
         self.assertEqual(e2.what(),eStr)
         pass
 
+    @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy")
+    def test14(self):
+        """Pickelization of DataArrayBytes"""
+        x=DataArrayByte(256,1)
+        for i in xrange(256):
+            x[i]=-128+i
+            pass
+        x.rearrange(2) ; x.setInfoOnComponents(["aa","bbb"])
+        x.setName("toto")
+        st=cPickle.dumps(x,cPickle.HIGHEST_PROTOCOL)
+        x2=cPickle.loads(st)
+        self.assertTrue(x2.isEqual(x))
+        pass
+
     def setUp(self):
         pass
     pass