code: def test_get_assigned_resources_in_pg(ray_start_cluster):
      cluster = ray_start_cluster
      cluster.add_node(num_cpus=3)
      ray.init(address=cluster.address)
  
      @ray.remote
      def get_assigned_resources():
          return ray.get_runtime_context().get_assigned_resources()
  
      resources = ray.get(
          get_assigned_resources.options(num_cpus=1).remote()
      )
      assert resources == {"CPU": 1}
  
      pg = ray.util.placement_group(bundles=[{"CPU": 3, "memory": 500}])
      ray.get(pg.ready())
  
      resources = ray.get(
          get_assigned_resources.options(
              num_cpus=1,
              scheduling_strategy=PlacementGroupSchedulingStrategy(
                  placement_group=pg
              ),
          ).remote()
      )
      assert resources == {"CPU": 1}
  
      resources = ray.get(
          get_assigned_resources.options(
              num_cpus=1,
              memory=100,
              scheduling_strategy=PlacementGroupSchedulingStrategy(
                  placement_group=pg, placement_group_bundle_index=0
              ),
          ).remote()
      )
      assert resources == {"CPU": 1, "memory": 100}
  
imports: import sys
  import warnings
  import os
  import pytest
  import ray
  from ray._private.utils import get_ray_doc_version
  import ray.cluster_utils
  from ray._private.test_utils import placement_group_assert_no_leak
  from ray._private.test_utils import skip_flaky_core_test_premerge
  from ray.util.client.ray_client_helpers import connect_to_client_or_not
  from ray.util.scheduling_strategies import PlacementGroupSchedulingStrategy
label_desc: Use image node_id 15 for calling a global function with example usage: test_get_assigned_resources_in_pg(ray_start_cluster) and returns: ray