From: eap Date: Wed, 14 Dec 2016 16:38:23 +0000 (+0300) Subject: 23403: [CEA 1993] test MEDCouplingBasicsTest4.py : call with bad type argument X-Git-Tag: V8_3_0a1~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d0fbe5dfe66722c5443e017113170446e19e977d;p=tools%2Fmedcoupling.git 23403: [CEA 1993] test MEDCouplingBasicsTest4.py : call with bad type argument Porting to swig-3 --- diff --git a/src/MEDCoupling_Swig/MEDCouplingMemArray.i b/src/MEDCoupling_Swig/MEDCouplingMemArray.i index 2424e9821..24c627485 100644 --- a/src/MEDCoupling_Swig/MEDCouplingMemArray.i +++ b/src/MEDCoupling_Swig/MEDCouplingMemArray.i @@ -2933,14 +2933,14 @@ namespace MEDCoupling const char *msg="MEDCoupling::DataArrayInt::setValues : Available API are : \n-DataArrayInt.setValues([1,3,4])\n-DataArrayInt.setValues([1,3,4],3)\n-DataArrayInt.setValues([1,3,4,5],2,2)\n-DataArrayInt.New(5)\n !"; if(PyList_Check(li) || PyTuple_Check(li)) { - if(nbOfTuples) + if(nbOfTuples && nbOfTuples != Py_None) { if(PyInt_Check(nbOfTuples)) { int nbOfTuples1=PyInt_AS_LONG(nbOfTuples); if(nbOfTuples<0) throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !"); - if(nbOfComp) + if(nbOfComp && nbOfComp != Py_None) { if(PyInt_Check(nbOfComp)) {//DataArrayInt.setValues([1,3,4,5],2,2) diff --git a/src/MEDLoader/Swig/MEDLoaderTest3.py b/src/MEDLoader/Swig/MEDLoaderTest3.py index 9dbc004f9..f84a7cfcd 100644 --- a/src/MEDLoader/Swig/MEDLoaderTest3.py +++ b/src/MEDLoader/Swig/MEDLoaderTest3.py @@ -3903,7 +3903,7 @@ class MEDLoaderTest3(unittest.TestCase): arr[:,0]=range(25) arr[:,1]=range(100,125) f.setArray(arr) - WriteField(fileName,f,2) + WriteField(fileName,f,True) f=MEDCouplingFieldDouble(ON_NODES,ONE_TIME) ; f.setMesh(m) f.setName("FieldNode") arr=DataArrayDouble(36,2) ; arr.setInfoOnComponents(compos) @@ -3968,7 +3968,7 @@ class MEDLoaderTest3(unittest.TestCase): arr[:,0]=range(25) arr[:,1]=range(100,125) f.setArray(arr) - WriteField(fileName,f,2) + WriteField(fileName,f,True) f=MEDCouplingFieldDouble(ON_NODES,ONE_TIME) ; f.setMesh(m) f.setName("FieldNode") arr=DataArrayDouble(36,2) ; arr.setInfoOnComponents(compos)