Esempio n. 1
0
	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)
Esempio n. 2
0
	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)
Esempio n. 3
0
 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
Esempio n. 4
0
 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
Esempio n. 5
0
	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)
Esempio n. 6
0
def delete(sdata, obj, axis=None):
    if isinstance(sdata, SimpleData):
        sdata = sdata.storage
    return new(array.delete(sdata, obj, axis))
Esempio n. 7
0
def delete(sdata, obj, axis=None) :
    if isinstance(sdata, SimpleData) :
        sdata = sdata.storage
    return new(array.delete(sdata, obj, axis))