gammatools/tests/test_functions/test_split_number.py

14 lines
427 B
Python
Raw Normal View History

2024-07-03 23:32:28 +00:00
import pytest
from app.functions.split_number import split_number
@pytest.mark.parametrize("n, expected", [
(4, (2, 2)), # even number split into equal parts
(5, (2, 3)), # odd number split into (n // 2) and (n // 2 + 1)
(0, (0, 0)), # zero case
(-4, (-2, -2)), # negative even number
(-5, (-3, -2)) # negative odd number
])
def test_split_number(n, expected):
assert split_number(n) == expected