code: def test_ChunkIterFactory(chunk_length):
      dataset = Dataset()
      collatefn = CommonCollateFn()
      batches = [["a"], ["b"]]
      iter_factory = ChunkIterFactory(
          dataset=dataset,
          batches=batches,
          batch_size=2,
          chunk_length=chunk_length,
          collate_fn=collatefn,
      )
  
      for key, batch in iter_factory.build_iter(0):
          for k, v in batch.items():
              if chunk_length == 3:
                  assert v.shape == (2, 3)
              elif chunk_length == "2,4":
                  assert (
                      v.ndim == 2
                      and v.shape[0] == 2
                      and v.shape[1] in (2, 4)
                  )
              elif chunk_length == "3-5":
                  assert (
                      v.ndim == 2
                      and v.shape[0] == 2
                      and v.shape[1] in (3, 4, 5)
                  )
  
file_path: espnet/test/espnet2/iterators/test_chunk_iter_factory.py
imports: import re
  import numpy
  import pytest
  from espnet2.iterators.chunk_iter_factory import ChunkIterFactory
  from espnet2.train.collate_fn import CommonCollateFn
label_desc: Use image node_id 1 for calling a global function with example usage: test_ChunkIterFactory(chunk_length) without return types