import pytest from app.utils import batch_iterable @pytest.mark.parametrize( "data, batch_size, expected", [ ( [1, 2, 3, 4, 5, 6, 7, 8, 9], 3, [ ([1, 2, 3], 0), ([4, 5, 6], 3), ([7, 8, 9], 6), ], ), ( [1, 2, 3, 4, 5, 6, 7, 8], 3, [ ([1, 2, 3], 0), ([4, 5, 6], 3), ([7, 8], 6), ], ), ( [1], 3, [ ([1], 0), ], ), ([], 3, []), ( [1, 2, 3], 10, [ ([1, 2, 3], 0), ], ), ( [1, 2, 3, 4], 1, [ ([1], 0), ([2], 1), ([3], 2), ([4], 3), ], ), ], ) def test_batch_iterable( data: list[int], batch_size: int, expected: list[tuple[list[int], int]] ) -> None: result = list(batch_iterable(data, batch_size)) assert result == expected, f"Expected {expected} but got {result}"