@@ -148,6 +148,12 @@ def test_on_the_mark(self):
148148 assert_array_equal (self .interpolate ([0 , 1 , 2 , 3 , 4 ]),
149149 [0 , 10 , 20 , 30 , 40 ])
150150
151+ def test_zero_gradient (self ):
152+ assert_array_equal (
153+ stratify .interpolate ([1 ], [0 , 1 , 1 , 2 ], [10 , 20 , 30 , 40 ],
154+ interpolation = 'linear' ),
155+ [20 ])
156+
151157 def test_inbetween (self ):
152158 assert_array_equal (self .interpolate ([0.5 , 1.25 , 2.5 , 3.75 ]),
153159 [5 , 12.5 , 25 , 37.5 ])
@@ -258,6 +264,12 @@ def test_below(self):
258264 def test_above (self ):
259265 assert_array_almost_equal (self .interpolate ([15.123 ]), [151.23 ])
260266
267+ def test_zero_gradient (self ):
268+ assert_array_almost_equal (
269+ stratify .interpolate ([2 ], [0 , 0 ], [1 , 1 ],
270+ extrapolation = 'linear' ),
271+ [1 ])
272+
261273 def test_npts (self ):
262274 interpolation = IndexInterpolator ()
263275 extrapolation = stratify .EXTRAPOLATE_LINEAR
@@ -369,7 +381,7 @@ class Test_interpolate(unittest.TestCase):
369381 def test_target_z_3d_axis_0 (self ):
370382 z_target = z_source = f_source = np .arange (3 ) * np .ones ([4 , 2 , 3 ])
371383 result = vinterp .interpolate (z_target , z_source , f_source ,
372- axis = 0 , extrapolation = 'linear' )
384+ extrapolation = 'linear' )
373385 assert_array_equal (result , f_source )
374386
375387
0 commit comments