code: def test_state_cacher(self, data_obj, params):
      key = "data_obj"
  
      state_cacher = StateCacher(**params)
      # store it
      state_cacher.store(key, data_obj, pickle_module=pickle)
      # create clone then modify original
      data_obj_orig = data_obj.clone()
      data_obj += 1
      # Restore and check nothing has changed
      data_obj_restored = state_cacher.retrieve(key)
      self.assertEqual(data_obj_orig, data_obj_restored)
  
      # If not allow overwrite, check an attempt would raise exception
      if "allow_overwrite" in params and params["allow_overwrite"]:
          with self.assertRaises(RuntimeError):
              state_cacher.store(key, data_obj)
  
      # If using a cache dir, check file has been deleted et end
      if "cache_dir" in params:
          i = id(state_cacher)
          del state_cacher
          self.assertFalse(
              exists(join(params["cache_dir"], f"state_{key}_{i}.pt"))
          )
  
file_path: MONAI/tests/test_state_cacher.py
imports: from __future__ import annotations
  import pickle
  import unittest
  from os.path import exists, join
  from pathlib import Path
  from tempfile import gettempdir
  import torch
  from parameterized import parameterized
  from monai.utils import StateCacher
label_desc: Use image node_id 1 for calling the TestStateCacher obj's underlying member method code with example usage: obj.test_state_cacher(data_obj, params) without return types