@@ -339,14 +339,33 @@ def test_inconsistent_shape(self):
339339 with self .assertRaisesRegexp (ValueError , emsg ):
340340 vinterp ._Interpolation ([1 , 3 ], data , zdata , axis = 2 )
341341
342- def test_axis_out_of_bounds (self ):
343- data = np .empty ([5 , 4 ])
344- zdata = np .empty ([5 , 4 ])
342+ def test_axis_out_of_bounds_fz_src_relative (self ):
343+ # axis is out of bounds as identified by the absolute axis with z_src.
344+ data = np .empty ((5 , 4 ))
345+ zdata = np .empty ((5 , 4 ))
345346 axis = 4
346347 emsg = 'Axis {} out of range'
347348 with self .assertRaisesRegexp (ValueError , emsg .format (axis )):
348349 vinterp ._Interpolation ([1 , 3 ], data , zdata , axis = axis )
349350
351+ def test_axis_out_of_bounds_z_src_absolute (self ):
352+ # axis is out of bounds as identified by the relative axis with fz_src.
353+ data = np .empty ((5 , 4 ))
354+ zdata = np .empty ((3 , 5 , 4 ))
355+ axis = 0
356+ emsg = 'Axis {} out of range'
357+ with self .assertRaisesRegexp (ValueError , emsg .format (axis )):
358+ vinterp ._Interpolation ([1 , 3 ], data , zdata , axis = axis )
359+
360+ def test_axis_greater_than_z_src_ndim (self ):
361+ # Ensure that axis is not unnecessarily constrained to the dimensions
362+ # of z_src.
363+ data = np .empty ((4 ))
364+ zdata = np .empty ((3 , 5 , 4 ))
365+ axis = 2
366+ result = vinterp ._Interpolation (data .copy (), data , zdata , axis = axis )
367+ self .assertEqual (result .result_shape , (3 , 5 , 4 ))
368+
350369 def test_nd_inconsistent_ndims (self ):
351370 z_target = np .empty ((2 , 3 , 4 ))
352371 z_src = np .empty ((3 , 4 ))
0 commit comments