code: def test_submit_scale_request(
      node_data_dict, scale_request, expected_patch_payload
  ):
      """Test the KubeRayNodeProvider's RayCluster patch payload given a dict
      of current node counts and a scale request.
      """
      raycluster = get_basic_ray_cr()
      # Add another worker group for the sake of this test.
      blah_group = copy.deepcopy(
          raycluster["spec"]["workerGroupSpecs"][1]
      )
      blah_group["groupName"] = "blah-group"
      raycluster["spec"]["workerGroupSpecs"].append(blah_group)
      with mock.patch.object(
          KubeRayNodeProvider, "__init__", return_value=None
      ):
          kr_node_provider = KubeRayNodeProvider(
              provider_config={}, cluster_name="fake"
          )
          kr_node_provider.node_data_dict = node_data_dict
          patch_payload = (
              kr_node_provider._scale_request_to_patch_payload(
                  scale_request=scale_request, raycluster=raycluster
              )
          )
          assert patch_payload == expected_patch_payload
  
imports: import copy
  import mock
  import sys
  import jsonpatch
  import pytest
  from ray.autoscaler.batching_node_provider import NodeData
  from ray.autoscaler._private.kuberay.node_provider import _worker_group_index, _worker_group_max_replicas, _worker_group_replicas, KubeRayNodeProvider, ScaleRequest
  from ray.autoscaler._private.util import NodeID
  from pathlib import Path
  import yaml
  from ray.tests.kuberay.test_autoscaling_config import get_basic_ray_cr
  from typing import Set, List
label_desc: Use image node_id 7 for calling a global function with example usage: test_submit_scale_request(node_data_dict, scale_request, expected_patch_payload) without return types