code: def test_rand_weighted_crop(
      self, _, input_params, img, weight, expected_shape, expected_vals
  ):
      crop = RandWeightedCrop(**input_params)
      crop.set_random_state(10)
      result = crop(img, weight)
      self.assertTrue(len(result) == input_params["num_samples"])
      assert_allclose(result[0].shape, expected_shape)
      for c, e in zip(crop.centers, expected_vals):
          assert_allclose(c, e, type_test=False)
      # if desired ROI is larger than image, check image is unchanged
      if all(
          s >= i
          for i, s in zip(img.shape[1:], input_params["spatial_size"])
      ):
          for res in result:
              assert_allclose(res, img, type_test="tensor")
              self.assertEqual(len(res.applied_operations), 1)
  
file_path: MONAI/tests/test_rand_weighted_crop.py
imports: from __future__ import annotations
  import unittest
  import numpy
  from parameterized.parameterized import parameterized
  from monai.data.meta_tensor import MetaTensor
  from monai.transforms.croppad.array import RandWeightedCrop
  from monai.transforms.lazy.functional import apply_pending
  from tests.croppers import CropTest
  from tests.utils import TEST_NDARRAYS_ALL, NumpyImageTestCase2D, NumpyImageTestCase3D, assert_allclose
label_desc: Use image node_id 1 for calling the TestRandWeightedCrop obj's underlying member method code with example usage: obj.test_rand_weighted_crop(_, input_params, img, weight, expected_shape, expected_vals) without return types