code: def test_gradient_checkpointing_is_applied(self):
      (
          init_dict,
          inputs_dict,
      ) = self.prepare_init_args_and_inputs_for_common()
      model_class_copy = copy.copy(self.model_class)
  
      modules_with_gc_enabled = {}
  
      # now monkey patch the following function:
      #     def _set_gradient_checkpointing(self, module, value=False):
      #         if hasattr(module, "gradient_checkpointing"):
      #             module.gradient_checkpointing = value
  
      def _set_gradient_checkpointing_new(self, module, value=False):
          if hasattr(module, "gradient_checkpointing"):
              module.gradient_checkpointing = value
              modules_with_gc_enabled[module.__class__.__name__] = True
  
      model_class_copy._set_gradient_checkpointing = (
          _set_gradient_checkpointing_new
      )
  
      model = model_class_copy(**init_dict)
      model.enable_gradient_checkpointing()
  
      EXPECTED_SET = {
          "CrossAttnUpBlockMotion",
          "CrossAttnDownBlockMotion",
          "UNetMidBlockCrossAttnMotion",
          "UpBlockMotion",
          "Transformer2DModel",
          "DownBlockMotion",
      }
  
      assert set(modules_with_gc_enabled.keys()) == EXPECTED_SET
      assert all(
          modules_with_gc_enabled.values()
      ), "All modules should be enabled"
  
imports: import copy
  import os
  import tempfile
  import unittest
  import numpy
  import torch
  from diffusers import MotionAdapter, UNet2DConditionModel, UNetMotionModel
  from diffusers.utils import logging
  from diffusers.utils.import_utils import is_xformers_available
  from diffusers.utils.testing_utils import enable_full_determinism, floats_tensor, torch_device
  from .test_modeling_common import ModelTesterMixin, UNetTesterMixin
label_desc: Use image node_id 10 for calling the UNetMotionModelTests obj's underlying member method code with example usage: obj.test_gradient_checkpointing_is_applied() without return types