diff --git a/tests/test_utils_npy.py b/tests/test_utils_npy.py index d48d4277b..338eea1b1 100644 --- a/tests/test_utils_npy.py +++ b/tests/test_utils_npy.py @@ -6,11 +6,11 @@ sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..') from slic.utils.npy import * @pytest.mark.parametrize("start, stop, step, expected", [ - (0, 5, 1, np.linspace(0, 5, 6)), # regular integer step - (5, 0, -1, np.linspace(5, 0, 6)), # reversed with negative step - (1, 2, 0.3, np.linspace(1, 2, 4)), # step doesn't divide evenly - (-2, 2, 1.5, np.linspace(-2, 2, 3)), # centered range - (2.5, 0.5, -0.4, np.linspace(2.5, 0.5, 6)), # reversed float + (0, 5, 1, [0, 1, 2, 3, 4, 5]), + (5, 0, -1, [5, 4, 3, 2, 1, 0]), + (1, 2, 3/10, [1, 4/3, 5/3, 2]), + (-2, 2, 3/2, [-2, -2/3, 2/3, 2]), + (5/2, 1/2, -2/5, [5/2, 21/10, 17/10, 13/10, 9/10, 1/2]) ]) def test_nice_arange(start, stop, step, expected): np.testing.assert_allclose(nice_arange(start, stop, step), expected)