code: def test_get_app_and_deployment_handle(serve_instance):
      """Test the `get_app_handle` and `get_deployment_handle` APIs."""
  
      @serve.deployment
      def downstream():
          return "hello"
  
      @serve.deployment
      class Deployment:
          def __init__(self, handle: RayServeHandle):
              pass
  
          async def check_get_deployment_handle(self):
              handle = serve.get_deployment_handle(
                  deployment_name="downstream"
              )
              assert isinstance(handle, DeploymentHandle)
  
              ref = handle.remote()
              assert isinstance(ref, DeploymentResponse)
              return await ref
  
      serve.run(Deployment.bind(downstream.bind()))
      handle = serve.get_app_handle("default")
      assert isinstance(handle, DeploymentHandle)
      assert (
          handle.check_get_deployment_handle.remote().result()
          == "hello"
      )
  
      handle = serve.get_deployment_handle(
          "downstream", app_name="default"
      )
      assert isinstance(handle, DeploymentHandle)
      assert handle.remote().result() == "hello"
  
file_path: ray/python/ray/serve/tests/test_new_handle_api.py
imports: import sys
  from typing import Any
  import pytest
  import ray
  from ray import serve
  from ray._private.test_utils import SignalActor
  from ray.serve.handle import DeploymentHandle, DeploymentResponse, DeploymentResponseGenerator, RayServeHandle, RayServeSyncHandle
label_desc: Use image node_id 3 for calling a global function with example usage: test_get_app_and_deployment_handle(serve_instance) and returns: str, unknown