"""Tests for util module.""" import pytest from accounting import util @pytest.mark.parametrize( 'n, source, expected_result', [ (4, range(0, 10), [[0, 1, 2, 3], [4, 5, 6, 7], [8, 9]]), (10, range(0, 10), [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]), (1, range(0, 10), [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9]]), (10, range(0, 10), [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]]), ] ) def test_grouper(n, source, expected_result): """Test grouper function iterates the correct sequence.""" result = [list(chunk) for chunk in util.grouper(n, source)] assert result == expected_result