code: def test_default_container(
      batch_dim_exc: t.Type[Exception], wrong_batch_dim: int
  ):
      l1 = [1, 2, 3]
      l2 = [3, 4, 5, 6]
      batch, indices = c.DefaultContainer.batches_to_batch([l1, l2])
      assert batch == l1 + l2
      assert indices == [0, 3, 7]
      restored_l1, restored_l2 = c.DefaultContainer.batch_to_batches(
          batch, indices
      )
      assert restored_l1 == l1
      assert restored_l2 == l2
  
      # DefaultContainer should only allow batch_dim = 0
      with pytest.raises(batch_dim_exc):
          c.DefaultContainer.batches_to_batch(
              [l1, l2], batch_dim=wrong_batch_dim
          )
  
      with pytest.raises(batch_dim_exc):
          c.DefaultContainer.batch_to_batches(
              batch, indices, batch_dim=wrong_batch_dim
          )
  
      def _generator():
          yield "apple"
          yield "banana"
          yield "cherry"
  
      assert c.DefaultContainer.from_payload(
          c.DefaultContainer.to_payload(_generator(), batch_dim=0)
      ) == list(_generator())
  
      assert c.DefaultContainer.from_batch_payloads(
          c.DefaultContainer.batch_to_payloads(batch, indices)
      ) == (batch, indices)
  
file_path: BentoML/tests/unit/_internal/runner/test_container.py
imports: from __future__ import annotations
  import typing
  import numpy
  import pandas
  import pytest
  import bentoml._internal.runner.container
label_desc: Use image node_id 1 for calling a global function with example usage: test_default_container(batch_dim_exc, wrong_batch_dim) without return types