code: def _do_gen_test(m, batch_size, n_items):
      def item_iterator():
          yield from range(n_items)
  
      for value, position_in_batch, batch_len in m.predict_gen(
          item_iterator(), batch_size=batch_size
      ):
          assert position_in_batch == value % batch_size
          if value < (n_items // batch_size) * batch_size:
              assert batch_len == batch_size
          else:
              assert (
                  batch_len
                  == n_items - n_items // batch_size * batch_size
              )
  
file_path: modelkit/tests/test_batching.py
imports: import asyncio
  import pytest
  from modelkit.core.model import AsyncModel, Model
label_desc: Use image node_id 6 for calling a global function with example usage: _do_gen_test(m, batch_size, n_items) without return types