From c5ba3855b582eac2d8be27fd378f075f26132a32 Mon Sep 17 00:00:00 2001 From: Jakob Scheid Date: Thu, 2 Apr 2026 14:21:32 +0200 Subject: [PATCH] Add tests for jeb_utils.utils.get_next_lower_integer_multiple --- .../test_get_next_lower_integer_multiple.py | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 tests/unit/utils/test_get_next_lower_integer_multiple.py diff --git a/tests/unit/utils/test_get_next_lower_integer_multiple.py b/tests/unit/utils/test_get_next_lower_integer_multiple.py new file mode 100644 index 0000000..1f97e09 --- /dev/null +++ b/tests/unit/utils/test_get_next_lower_integer_multiple.py @@ -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) \ No newline at end of file