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

This commit is contained in:
2025-08-10 21:49:26 +02:00
parent f1028e896b
commit c96aa969c6
+5 -5
View File
@@ -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)