Salome HOME
Pickelization of (squashed merge of agy/PyPickelingOfMCObj) :
[tools/medcoupling.git] / src / MEDCoupling_Swig / MEDCouplingNumPyTest.py
index 0fcfe6c3fbe5a467bc9a7c8dede03e42a422af3f..e5d7943bf1531970fb5d94b28e9c0a2626e29642 100644 (file)
@@ -1,10 +1,10 @@
 #  -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2013  CEA/DEN, EDF R&D
+# Copyright (C) 2007-2015  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
 # License as published by the Free Software Foundation; either
-# version 2.1 of the License.
+# version 2.1 of the License, or (at your option) any later version.
 #
 # This library is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -17,7 +17,6 @@
 #
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
-# 
 
 from MEDCoupling import *
 
@@ -32,7 +31,7 @@ import os,gc,weakref,unittest
 
 class MEDCouplingNumPyTest(unittest.TestCase):
     
-    @unittest.skipUnless(MEDCouplingHasNumPyBindings() and architecture()[0]=="64bit","requires numpy")
+    @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy")
     def test1(self):
         sz=20
         a=array(0,dtype=int32)
@@ -40,6 +39,7 @@ class MEDCouplingNumPyTest(unittest.TestCase):
         a[:]=4
         self.assertEqual(getrefcount(a),2)
         a=a.cumsum(dtype=int32)
+        a=array(a,dtype=int64) ; a=array(a,dtype=int32)
         self.assertEqual(getrefcount(a),2)
         d=DataArrayInt(a)
         d[:]=2
@@ -656,6 +656,14 @@ class MEDCouplingNumPyTest(unittest.TestCase):
         self.assertEqual(a2.tolist(),[[0.,1.,2.],[3.,4.,5.],[6.,7.,8.],[9.,10.,11.],[12.,13.,14.]])
         pass
 
+    @unittest.skipUnless(MEDCouplingHasNumPyBindings(),"requires numpy")
+    def test27(self):
+        m0=DenseMatrix(DataArrayDouble([2,3,4,5,1,6]),2,3)
+        m0np=m0.toNumPyMatrix()
+        self.assertEqual(m0np.shape,(2,3))
+        self.assertEqual(m0np.tolist(),[[2.0,3.0,4.0],[5.0,1.0,6.0]])
+        pass
+
     def setUp(self):
         pass
     pass