code: def _do_model_test(model, ITEMS):
      for i in ITEMS:
          res = model(i, _force_compute=True)
          if isinstance(res, pydantic.BaseModel):
              res = res.model_dump()
          assert i == res
  
      batch_results = model.predict_batch(ITEMS)
      if isinstance(batch_results[0], pydantic.BaseModel):
          batch_results = [res.model_dump() for res in batch_results]
      assert batch_results == ITEMS
  
      batch_results = model.predict_batch(
          ITEMS + [{"ok": {"boomer": [-1]}}]
      )
      if isinstance(batch_results[0], pydantic.BaseModel):
          batch_results = [res.model_dump() for res in batch_results]
      assert batch_results == ITEMS + [{"ok": {"boomer": [-1]}}]
  
file_path: modelkit/tests/test_caching.py
imports: import asyncio
  import os
  import subprocess
  import time
  from typing import List, Union
  import pydantic
  import pytest
  import redis
  import modelkit.utils.redis
  from modelkit.core.library import ModelLibrary
  from modelkit.core.model import AsyncModel, Model
  from modelkit.utils.cache import NativeCache, RedisCache
  from tests.conftest import skip_unless
label_desc: Use image node_id 3 for calling a global function with example usage: _do_model_test(model, ITEMS) without return types