code: def test_spacingd(
      self, _, data, kw_args, expected_shape, expected_affine, device
  ):
      data = {k: v.to(device) for k, v in data.items()}
      tr = Spacingd(**kw_args)
      call_param = {"data": data}
      res = tr(**call_param)
      # test lazy
      if not isinstance(kw_args["keys"], str):  # multiple keys
          kw_args["mode"] = ensure_tuple_rep(
              kw_args["mode"], len(kw_args["keys"])
          )
          init_param = kw_args.copy()
          for key, mode in zip(kw_args["keys"], kw_args["mode"]):
              init_param["keys"], init_param["mode"] = key, mode
              test_resampler_lazy(
                  tr, res, init_param, call_param, output_key=key
              )
      else:
          test_resampler_lazy(
              tr, res, kw_args, call_param, output_key=kw_args["keys"]
          )
      in_img = data["image"]
      out_img = res["image"]
      self.assertEqual(in_img.device, out_img.device)
      # no change in number of keys
      self.assertEqual(tuple(sorted(data)), tuple(sorted(res)))
      np.testing.assert_allclose(out_img.shape, expected_shape)
      assert_allclose(out_img.affine, expected_affine)
  
file_path: MONAI/tests/test_spacingd.py
imports: from __future__ import annotations
  import unittest
  import numpy
  import torch
  from parameterized import parameterized
  from monai.data.meta_obj import set_track_meta
  from monai.data.meta_tensor import MetaTensor
  from monai.data.utils import affine_to_spacing
  from monai.transforms import Spacingd
  from monai.utils import ensure_tuple_rep
  from tests.lazy_transforms_utils import test_resampler_lazy
  from tests.utils import TEST_DEVICES, assert_allclose, skip_if_quick
label_desc: Use image node_id 1 for calling the TestSpacingDCase obj's underlying member method code with example usage: obj.test_spacingd(_, data, kw_args, expected_shape, expected_affine, device) without return types