code: def test_simple_replace():
      scanner = _PyObjScanner(source_type=Source)
      my_objs = [Source(), [Source(), {"key": Source()}]]
  
      found = scanner.find_nodes(my_objs)
      assert len(found) == 3
  
      replaced = scanner.replace_nodes({obj: 1 for obj in found})
      assert replaced == [1, [1, {"key": 1}]]
  
file_path: ray/python/ray/dag/tests/test_py_obj_scanner.py
imports: import pytest
  from typing import Any
  from ray.dag.py_obj_scanner import _PyObjScanner, _instances
label_desc: Use image node_id 1 for calling a global function with example usage: test_simple_replace() without return types