code: def test_duplicate_args(ray_start_regular_shared):
      @ray.remote
      def f(
          arg1,
          arg2,
          arg1_duplicate,
          kwarg1=None,
          kwarg2=None,
          kwarg1_duplicate=None,
      ):
          assert arg1 == kwarg1
          assert arg1 != arg2
          assert arg1 == arg1_duplicate
          assert kwarg1 != kwarg2
          assert kwarg1 == kwarg1_duplicate
  
      # Test by-value arguments.
      arg1 = [1]
      arg2 = [2]
      ray.get(
          f.remote(
              arg1,
              arg2,
              arg1,
              kwarg1=arg1,
              kwarg2=arg2,
              kwarg1_duplicate=arg1,
          )
      )
  
      # Test by-reference arguments.
      arg1 = ray.put([1])
      arg2 = ray.put([2])
      ray.get(
          f.remote(
              arg1,
              arg2,
              arg1,
              kwarg1=arg1,
              kwarg2=arg2,
              kwarg1_duplicate=arg1,
          )
      )
  
      # Test by-reference arguments on an actor task.
      @ray.remote
      class Actor:
          def f(
              self,
              arg1,
              arg2,
              arg1_duplicate,
              kwarg1=None,
              kwarg2=None,
              kwarg1_duplicate=None,
          ):
              assert arg1 == kwarg1
              assert arg1 != arg2
              assert arg1 == arg1_duplicate
              assert kwarg1 != kwarg2
              assert kwarg1 == kwarg1_duplicate
  
      actor = Actor.remote()
      ray.get(
          actor.f.remote(
              arg1,
              arg2,
              arg1,
              kwarg1=arg1,
              kwarg2=arg2,
              kwarg1_duplicate=arg1,
          )
      )
  
imports: import array
  import logging
  import os
  import random
  import subprocess
  import sys
  import tempfile
  import threading
  import time
  from unittest.mock import MagicMock, patch
  import pytest
  from ray._private.ray_constants import KV_NAMESPACE_FUNCTION_TABLE
  from ray._private.test_utils import client_test_enabled
  from ray.cluster_utils import Cluster, cluster_not_supported
  from ray.exceptions import GetTimeoutError, RayTaskError
  from ray.tests.client_test_utils import create_remote_signal_actor
label_desc: Use image node_id 20 for calling a global function with example usage: test_duplicate_args(ray_start_regular_shared) without return types