X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDCoupling_Swig%2FMEDCouplingNumPyTest.py;h=fbc5aeaa53581b18a537917cfd4a99d0f463bbf7;hb=3b87b308aa06939cf3b5a26f6d8f9f881d108b1d;hp=0fcfe6c3fbe5a467bc9a7c8dede03e42a422af3f;hpb=ac6dca68fea259601f93ce3bca72dd9bf20a73a2;p=tools%2Fmedcoupling.git diff --git a/src/MEDCoupling_Swig/MEDCouplingNumPyTest.py b/src/MEDCoupling_Swig/MEDCouplingNumPyTest.py index 0fcfe6c3f..fbc5aeaa5 100644 --- a/src/MEDCoupling_Swig/MEDCouplingNumPyTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingNumPyTest.py @@ -1,10 +1,10 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2013 CEA/DEN, EDF R&D +# Copyright (C) 2007-2014 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