Update tests/test_utils_npy.py
Run CI Tests / test (push) Successful in 1m2s

This commit is contained in:
2025-08-10 22:09:33 +02:00
parent c96aa969c6
commit cf3c3f1faf
+3 -2
View File
@@ -7,10 +7,10 @@ from slic.utils.npy import *
@pytest.mark.parametrize("start, stop, step, expected", [
(0, 5, 1, [0, 1, 2, 3, 4, 5]),
(5, 0, -1, [5, 4, 3, 2, 1, 0]),
(5, 0, -1, [0, 1, 2, 3, 4, 5]),
(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])
(5/2, 1/2, -2/5, [1/2, 9/10, 13/10, 17/10, 21/10, 5/2])
])
def test_nice_arange(start, stop, step, expected):
np.testing.assert_allclose(nice_arange(start, stop, step), expected)
@@ -24,6 +24,7 @@ def test_nice_arange(start, stop, step, expected):
(2, 2, 3, np.array([2., 2., 2., 2.])), # constant start = stop
(3, 0, 3, np.array([3., 2., 1., 0.])), # decreasing
(0, 1, 0, np.array([0.])), # edge case: 0 intervals → 1 point
(-2, 2, 3, np.array([-2, -2/3, 2/3, 2])),
])
def test_nice_linspace(start, stop, num, expected):
np.testing.assert_allclose(nice_linspace(start, stop, num), expected)