예제 #1
0
 def testShapeIndex(self):
     a = numpy.arange(24)
     a.shape = (1,2,3,4)
     def shape_check(i):
         print(i)
         self.assertEqual(ndarray_ext.shape_index(a,i) ,a.shape[i] )
     for i in range(4):
         shape_check(i)
     for i in range(-1,-5,-1):
         shape_check(i)
     try:
         ndarray_ext.shape_index(a,4) # out of bounds -- should raise IndexError
         self.assertTrue(False)
     except IndexError:
         pass
예제 #2
0
 def testShapeIndex(self):
     a = numpy.arange(24)
     a.shape = (1,2,3,4)
     def shape_check(i):
         print(i)
         self.assertEqual(ndarray_ext.shape_index(a,i) ,a.shape[i] )
     for i in range(4):
         shape_check(i)
     for i in range(-1,-5,-1):
         shape_check(i)
     try:
         ndarray_ext.shape_index(a,4) # out of bounds -- should raise IndexError
         self.assertTrue(False)
     except IndexError:
         pass
예제 #3
0
 def shape_check(i):
     print(i)
     self.assertEqual(ndarray_ext.shape_index(a,i) ,a.shape[i] )
예제 #4
0
 def shape_check(i):
     print(i)
     self.assertEqual(ndarray_ext.shape_index(a,i) ,a.shape[i] )