Add tests for jeb_utils.utils.get_next_lower_integer_multiple

This commit is contained in:
2026-04-02 14:21:32 +02:00
parent 91696ad034
commit c5ba3855b5
@@ -0,0 +1,46 @@
from src.jeb_utils.utils import get_next_lower_integer_multiple
import pytest
@pytest.mark.parametrize('value,multiple,expected', [
(1, 1, 1),
(2, 1, 2),
(3, 1, 3),
(1, 2, 0),
(1, 2, 0),
(58, 42, 42),
(125, 42, 84),
(126, 42, 126),
(127, 42, 126),
(-1, -1, -1),
(-2, -1, -2),
(-3, -1, -3),
(-1, -2, 0),
(-1, -2, 0),
(-58, -42, -42),
(-125, -42, -84),
(-126, -42, -126),
(-127, -42, -126),
(-1, 1, -1),
(-2, 1, -2),
(-3, 1, -3),
(-1, 2, 0),
(-1, 2, 0),
(-58, 42, -42),
(-125, 42, -84),
(-126, 42, -126),
(-127, 42, -126),
])
def test_get_next_lower_integer_multiple(value, multiple, expected):
assert get_next_lower_integer_multiple(value, multiple) == expected
@pytest.mark.parametrize('value,multiple,expected_exception', [
(1, 0, ZeroDivisionError),
(2, 0, ZeroDivisionError),
(0, 0, ZeroDivisionError),
(-1, 0, ZeroDivisionError),
])
def test_get_next_lower_integer_multiple(value, multiple, expected_exception):
with pytest.raises(expected_exception):
get_next_lower_integer_multiple(value, multiple)