def test__array_delete(self): """ -- Verifica la funcion delete """ arr=Array(10) arr[0]=10 arr[1]=20 arr[2]=30 arr[3]=40 #print(arr) delete(arr,20) #print(arr) res=arr[1] #print(res) self.assertEqual(res,30)
def test__array_delete_last_element(self): """ -- Borrar el ultimo elemento del array """ arr=Array(10,0) arr[0]=10 arr[1]=20 arr[2]=30 arr[3]=40 #print(arr) delete(arr,40) #print(arr) res=arr[3] #print(res) self.assertEqual(res,None)
def delete_slice(self, indices): slices = [] if type(indices) is int: slices = [indices] elif hasattr(indices, '__len__'): slices = indices else: raise AttributeError, 'indices must be either integer value or integer list' if len(slices) > 0: narr = array.delete(self.storage, slices, 0) oname = self.__iDataItem__.getShortName() self.__iDataItem__ = nx_factory.\ createNXsignal(None, oname, narr.__iArray__) self.storage = narr
def delete_slice(self, indices): slices = [] if type(indices) is int : slices = [indices] elif hasattr(indices, '__len__') : slices = indices else : raise AttributeError, 'indices must be either integer value or integer list' if len(slices) > 0 : narr = array.delete(self.storage, slices, 0) oname = self.__iDataItem__.getShortName() self.__iDataItem__ = nx_factory.\ createNXsignal(None, oname, narr.__iArray__) self.storage = narr
def test_array_delete_element_inexistent(self): """ -- Borrar un elemento inexistente de un array y se verifica que delete devuelva None """ arr=Array(10,0) res=delete(arr,1) self.assertEqual(res,None)
def delete(sdata, obj, axis=None): if isinstance(sdata, SimpleData): sdata = sdata.storage return new(array.delete(sdata, obj, axis))
def delete(sdata, obj, axis=None) : if isinstance(sdata, SimpleData) : sdata = sdata.storage return new(array.delete(sdata, obj, axis))