def test_valid_origins():
 func = (lambda x: np.mean(x))
 data = np.array([1, 2, 3, 4, 5], dtype=np.float64)
 assert_raises(ValueError, sndi.generic_filter, data, func, size=3, origin=2)
 func2 = (lambda x, y: np.mean((x + y)))
 assert_raises(ValueError, sndi.generic_filter1d, data, func, filter_size=3, origin=2)
 assert_raises(ValueError, sndi.percentile_filter, data, 0.2, size=3, origin=2)
 for filter in [sndi.uniform_filter, sndi.minimum_filter, sndi.maximum_filter, sndi.maximum_filter1d, sndi.median_filter, sndi.minimum_filter1d]:
  list(filter(data, 3, origin=(-1)))
  list(filter(data, 3, origin=1))
  assert_raises(ValueError, filter, data, 3, origin=2)

def test_valid_origins ( ) : func = ( lambda x : np . mean ( x ) ) data = np . array ( [ 1 , 2 , 3 , 4 , 5 ] , dtype = np . float64 ) assert_raises ( ValueError , sndi . generic_filter , data , func , size = 3 , origin = 2 ) func2 = ( lambda x , y : np . mean ( ( x + y ) ) ) assert_raises ( ValueError , sndi . generic_filter1d , data , func , filter_size = 3 , origin = 2 ) assert_raises ( ValueError , sndi . percentile_filter , data , 0.2 , size = 3 , origin = 2 ) for filter in [ sndi . uniform_filter , sndi . minimum_filter , sndi . maximum_filter , sndi . maximum_filter1d , sndi . median_filter , sndi . minimum_filter1d ] : list ( filter ( data , 3 , origin = ( - 1 ) ) ) list ( filter ( data , 3 , origin = 1 ) ) assert_raises ( ValueError , filter , data , 3 , origin = 2 )
regression test for #1311 .