code: def test_get_node_data(podlist_file: str, expected_node_data):
      """Test translation of a K8s pod list into autoscaler node data."""
      pod_list = _get_test_yaml(podlist_file)
  
      def mock_get(node_provider, path):
          if "pods" in path:
              return pod_list
          elif "raycluster" in path:
              return get_basic_ray_cr()
          else:
              raise ValueError("Invalid path.")
  
      with mock.patch.object(
          KubeRayNodeProvider, "__init__", return_value=None
      ), mock.patch.object(KubeRayNodeProvider, "_get", mock_get):
          kr_node_provider = KubeRayNodeProvider(
              provider_config={}, cluster_name="fake"
          )
          kr_node_provider.cluster_name = "fake"
          nodes = kr_node_provider.non_terminated_nodes({})
          assert kr_node_provider.node_data_dict == expected_node_data
          assert set(nodes) == set(expected_node_data.keys())
  
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 6 for calling a global function with example usage: test_get_node_data(podlist_file, expected_node_data) and returns: pod_list, get_basic_ray_cr