# -*- 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
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-#
from MEDCoupling import *
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)
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
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