docstr: testing no inplace change to the hashed item
docstr_tok: ["testing","no","inplace","change","to","the","hashed","item"]
code: def test_cache(self):
      """testing no inplace change to the hashed item"""
      items = [[list(range(i))] for i in range(5)]
  
      with tempfile.TemporaryDirectory() as tempdir:
          ds = LMDBDataset(
              items,
              transform=_InplaceXform(),
              cache_dir=tempdir,
              lmdb_kwargs={"map_size": 10 * 1024},
          )
          self.assertEqual(
              items,
              [[[]], [[0]], [[0, 1]], [[0, 1, 2]], [[0, 1, 2, 3]]],
          )
          ds1 = LMDBDataset(
              items,
              transform=_InplaceXform(),
              cache_dir=tempdir,
              lmdb_kwargs={"map_size": 10 * 1024},
          )
          self.assertEqual(list(ds1), list(ds))
          self.assertEqual(
              items,
              [[[]], [[0]], [[0, 1]], [[0, 1, 2]], [[0, 1, 2, 3]]],
          )
  
          ds = LMDBDataset(
              items,
              transform=_InplaceXform(),
              cache_dir=tempdir,
              lmdb_kwargs={"map_size": 10 * 1024},
              hash_func=json_hashing,
          )
          self.assertEqual(
              items,
              [[[]], [[0]], [[0, 1]], [[0, 1, 2]], [[0, 1, 2, 3]]],
          )
          ds1 = LMDBDataset(
              items,
              transform=_InplaceXform(),
              cache_dir=tempdir,
              lmdb_kwargs={"map_size": 10 * 1024},
              hash_func=json_hashing,
          )
          self.assertEqual(list(ds1), list(ds))
          self.assertEqual(
              items,
              [[[]], [[0]], [[0, 1]], [[0, 1, 2]], [[0, 1, 2, 3]]],
          )
  
      self.assertTrue(isinstance(ds1.info(), dict))
  
file_path: MONAI/tests/test_lmdbdataset.py
imports: from __future__ import annotations
  import os
  import tempfile
  import unittest
  import nibabel
  import numpy
  from parameterized import parameterized
  from monai.data import LMDBDataset, json_hashing
  from monai.transforms import Compose, LoadImaged, SimulateDelayd, Transform
  from tests.utils import skip_if_windows
label_desc: Use image node_id 1 for calling the TestLMDBDataset obj's underlying member method code with example usage: obj.test_cache() without return types