code: def test_codec(
      input_: Any,
      codec: KeyValueCodec,
      expected_result: Any,
      app_context: AppContext,
  ) -> None:
      from superset.extensions.metastore_cache import (
          SupersetMetastoreCache,
      )
  
      cache = SupersetMetastoreCache(
          namespace=NAMESPACE,
          default_timeout=600,
          codec=codec,
      )
      cm = (
          pytest.raises(type(expected_result))
          if isinstance(expected_result, Exception)
          else nullcontext()
      )
      with cm:
          cache.set(FIRST_KEY, input_)
          assert cache.get(FIRST_KEY) == expected_result
  
file_path: superset/tests/integration_tests/extensions/metastore_cache_test.py
imports: from __future__ import annotations
  from contextlib import nullcontext
  from datetime import datetime, timedelta
  from typing import Any, TYPE_CHECKING
  from uuid import UUID
  import pytest
  from flask.ctx import AppContext
  from freezegun import freeze_time
  from superset.key_value.exceptions import KeyValueCodecEncodeException
  from superset.key_value.types import JsonKeyValueCodec, KeyValueCodec, PickleKeyValueCodec
label_desc: Use image node_id 4 for calling a global function with example usage: test_codec(input_, codec, expected_result, app_context) without return types