code: def test_lambda_slicing(self):
      for p in TEST_NDARRAYS:
          img = p(self.imt)
  
          def slice_func(x):
              return x[:, :, :6, ::2]
  
          lambd = Lambda(func=slice_func)
          out = lambd(img)
          assert_allclose(slice_func(img), out, type_test=False)
          self.assertIsInstance(out, MetaTensor)
          self.assertEqual(len(out.applied_operations), 1)
          out = lambd.inverse(out)
          self.assertEqual(len(out.applied_operations), 0)
  
file_path: MONAI/tests/test_lambda.py
imports: from __future__ import annotations
  import unittest
  from numpy import ndarray
  from torch import Tensor
  from monai.data.meta_tensor import MetaTensor
  from monai.transforms.utility.array import Lambda
  from monai.utils.type_conversion import convert_to_numpy, convert_to_tensor
  from tests.utils import TEST_NDARRAYS, NumpyImageTestCase2D, assert_allclose
label_desc: Use image node_id 2 for calling the TestLambda obj's underlying member method code with example usage: obj.test_lambda_slicing() and returns: x