Esempio n. 1
0
 def testNdarray(self):    
     a = range(0,60)
     for dtp in (numpy.int16, numpy.int32, numpy.float32, numpy.complex128):
         v = numpy.array(a, dtype=dtp)
         dt = numpy.dtype(dtp)
         a1 = ndarray_ext.array(a)
         a2 = ndarray_ext.array(a,dt)
         self.assert_((a1 == v).all())
         self.assert_((a2 == v).all())
         for shape in ((60,),(6,10),(4,3,5),(2,2,3,5)):
             a1 = a1.reshape(shape)
             self.assertEqual(shape,a1.shape)
             a2 = a2.reshape(shape)
             self.assertEqual(shape,a2.shape)
Esempio n. 2
0
 def testNdarray(self):    
     a = range(0,60)
     for dtp in (numpy.int16, numpy.int32, numpy.float32, numpy.complex128):
         v = numpy.array(a, dtype=dtp)
         dt = numpy.dtype(dtp)
         a1 = ndarray_ext.array(a)
         a2 = ndarray_ext.array(a,dt)
         self.assert_((a1 == v).all())
         self.assert_((a2 == v).all())
         for shape in ((60,),(6,10),(4,3,5),(2,2,3,5)):
             a1 = a1.reshape(shape)
             self.assertEqual(shape,a1.shape)
             a2 = a2.reshape(shape)
             self.assertEqual(shape,a2.shape)