def test_to_midstep(): x = np.arange(4) y1 = np.arange(4) y2 = np.arange(4)[::-1] xs, y1s, y2s = cbook.pts_to_midstep(x, y1, y2) x_target = np.asarray([0, .5, .5, 1.5, 1.5, 2.5, 2.5, 3], dtype='float') y1_target = np.asarray([0, 0, 1, 1, 2, 2, 3, 3], dtype='float') y2_target = np.asarray([3, 3, 2, 2, 1, 1, 0, 0], dtype='float') assert_array_equal(x_target, xs) assert_array_equal(y1_target, y1s) assert_array_equal(y2_target, y2s) xs, y1s = cbook.pts_to_midstep(x, y1) assert_array_equal(x_target, xs) assert_array_equal(y1_target, y1s)
def test_to_midstep_empty(): steps = cbook.pts_to_midstep([], []) assert steps.shape == (2, 0)