def test_extract_array_return_pos():
 large_test_array = np.arange(5)
 for i in np.arange((-1), 6):
  (extracted, new_pos) = extract_array(large_test_array, 3, i, mode=u'partial', return_position=True)
  assert (new_pos == (1,))
 for (i, expected) in zip([1.49, 1.51, 3], [1.49, 0.51, 1]):
  (extracted, new_pos) = extract_array(large_test_array, (2,), (i,), mode=u'strict', return_position=True)
  assert (new_pos == (expected,))
 for (i, expected) in zip(np.arange((-1), 6), ((-1), 0, 1, 1, 1, 1, 1)):
  (extracted, new_pos) = extract_array(large_test_array, (3,), (i,), mode=u'trim', return_position=True)
  assert (new_pos == (expected,))

def test_extract_array_return_pos ( ) : large_test_array = np . arange ( 5 ) for i in np . arange ( ( - 1 ) , 6 ) : ( extracted , new_pos ) = extract_array ( large_test_array , 3 , i , mode = u'partial' , return_position = True ) assert ( new_pos == ( 1 , ) ) for ( i , expected ) in zip ( [ 1.49 , 1.51 , 3 ] , [ 1.49 , 0.51 , 1 ] ) : ( extracted , new_pos ) = extract_array ( large_test_array , ( 2 , ) , ( i , ) , mode = u'strict' , return_position = True ) assert ( new_pos == ( expected , ) ) for ( i , expected ) in zip ( np . arange ( ( - 1 ) , 6 ) , ( ( - 1 ) , 0 , 1 , 1 , 1 , 1 , 1 ) ) : ( extracted , new_pos ) = extract_array ( large_test_array , ( 3 , ) , ( i , ) , mode = u'trim' , return_position = True ) assert ( new_pos == ( expected , ) )
check that the return position is calculated correctly .