def test_sg_filter_trivial():
 x = np.array([1.0])
 y = savgol_filter(x, 1, 0)
 assert_equal(y, [1.0])
 x = np.array([3.0])
 y = savgol_filter(x, 3, 1, mode='constant')
 assert_almost_equal(y, [1.0], decimal=15)
 x = np.array([3.0])
 y = savgol_filter(x, 3, 1, mode='nearest')
 assert_almost_equal(y, [3.0], decimal=15)
 x = np.array(([1.0] * 3))
 y = savgol_filter(x, 3, 1, mode='wrap')
 assert_almost_equal(y, [1.0, 1.0, 1.0], decimal=15)

def test_sg_filter_trivial ( ) : x = np . array ( [ 1.0 ] ) y = savgol_filter ( x , 1 , 0 ) assert_equal ( y , [ 1.0 ] ) x = np . array ( [ 3.0 ] ) y = savgol_filter ( x , 3 , 1 , mode = 'constant' ) assert_almost_equal ( y , [ 1.0 ] , decimal = 15 ) x = np . array ( [ 3.0 ] ) y = savgol_filter ( x , 3 , 1 , mode = 'nearest' ) assert_almost_equal ( y , [ 3.0 ] , decimal = 15 ) x = np . array ( ( [ 1.0 ] * 3 ) ) y = savgol_filter ( x , 3 , 1 , mode = 'wrap' ) assert_almost_equal ( y , [ 1.0 , 1.0 , 1.0 ] , decimal = 15 )
test some trivial edge cases for savgol_filter() .