1 from muutils.mlutils import chunks

2

3

4 def test_chunks_empty():

5 input_list = []

6 chunk_size = 3

7 expected_output = []

8 assert list(chunks(input_list, chunk_size)) == expected_output

9

10

11 def test_chunks_single():

12 input_list = ["a"]

13 expected_output = [["a"]]

14 assert list(chunks(input_list, 1)) == expected_output

15 assert list(chunks(input_list, 2)) == expected_output

16

17

18 def test_chunks_batch_multiple():

19 input_list = list(range(6))

20 chunk_size = 3

21 expected_output = [[0, 1, 2], [3, 4, 5]]

22 assert list(chunks(input_list, chunk_size)) == expected_output

23

24

25 def test_chunks_batch_remainder():

26 input_list = list(range(7))

27 chunk_size = 3

28 expected_output = [[0, 1, 2], [3, 4, 5], [6]]

29 assert list(chunks(input_list, chunk_size)) == expected_output

30

31

32 def test_chunks_longer():

33 input_list = list(range(10))

34 chunk_size = 3

35 expected_output = [[0, 1, 2], [3, 4, 5], [6, 7, 8], [9]]

36 assert list(chunks(input_list, chunk_size)) == expected_output

37

38

39 def test_chunks_strings():

40 input_list = ["a", "b", "c", "d", "e"]

41 chunk_size = 2

42 expected_output = [["a", "b"], ["c", "d"], ["e"]]

43 assert list(chunks(input_list, chunk_size)) == expected_output