code: def test_serialization_error_message(shutdown_only):
      expected_output_ray_put = """Could not serialize the put value <unlocked _thread.lock object at ADDRESS>:\nINSPECT_SERIALIZABILITY"""  # noqa
      expected_output_task = """Could not serialize the argument <unlocked _thread.lock object at ADDRESS> for a task or actor test_traceback.test_serialization_error_message.<locals>.task_with_unserializable_arg:\nINSPECT_SERIALIZABILITY"""  # noqa
      expected_output_actor = """Could not serialize the argument <unlocked _thread.lock object at ADDRESS> for a task or actor test_traceback.test_serialization_error_message.<locals>.A.__init__:\nINSPECT_SERIALIZABILITY"""  # noqa
      expected_capture_output_task = """Could not serialize the function test_traceback.test_serialization_error_message.<locals>.capture_lock:\nINSPECT_SERIALIZABILITY"""  # noqa
      expected_capture_output_actor = """Could not serialize the actor class test_traceback.test_serialization_error_message.<locals>.B.__init__:\nINSPECT_SERIALIZABILITY"""  # noqa
      ray.init(num_cpus=1)
      lock = threading.Lock()
  
      @ray.remote
      def task_with_unserializable_arg(lock):
          print(lock)
  
      @ray.remote
      class A:
          def __init__(self, lock):
              print(lock)
  
      @ray.remote
      def capture_lock():
          print(lock)
  
      @ray.remote
      class B:
          def __init__(self):
              print(lock)
  
      """
      Test ray.put() an unserializable object.
      """
      with pytest.raises(TypeError) as excinfo:
          ray.put(lock)
  
      assert clean_noqa(expected_output_ray_put) == scrub_traceback(
          str(excinfo.value)
      )
      """
      Test a task with an unserializable object.
      """
      with pytest.raises(TypeError) as excinfo:
          task_with_unserializable_arg.remote(lock)
  
      assert clean_noqa(expected_output_task) == scrub_traceback(
          str(excinfo.value)
      )
      """
      Test an actor with an unserializable object.
      """
      with pytest.raises(TypeError) as excinfo:
          a = A.remote(lock)
          print(a)
      assert clean_noqa(expected_output_actor) == scrub_traceback(
          str(excinfo.value)
      )
      """
      Test the case where an unserializable object is captured by tasks.
      """
      with pytest.raises(TypeError) as excinfo:
          capture_lock.remote()
      assert clean_noqa(
          expected_capture_output_task
      ) == scrub_traceback(str(excinfo.value))
      """
      Test the case where an unserializable object is captured by actors.
      """
      with pytest.raises(TypeError) as excinfo:
          b = B.remote()
          print(b)
      assert clean_noqa(
          expected_capture_output_actor
      ) == scrub_traceback(str(excinfo.value))
  
file_path: ray/python/ray/tests/test_traceback.py
imports: import re
  import sys
  import threading
  import pytest
  import ray
  from ray.exceptions import RayTaskError, RayActorError
label_desc: Use image node_id 10 for calling a global function with example usage: test_serialization_error_message(shutdown_only) without return types