code: def test_trace_to_file(stream_trace):
      file = tempfile.NamedTemporaryFile(mode="r")
      with detect.trace(file.name, mode="w"):
          dill.dumps(test_obj)
      file_trace = file.read()
      file.close()
      # Apparently, objects can change location in memory...
      reghex = re.compile(r"0x[0-9A-Za-z]+")
      file_trace, stream_trace = reghex.sub(
          "0x", file_trace
      ), reghex.sub("0x", stream_trace)
      # PyPy prints dictionary contents with repr(dict)...
      regdict = re.compile(r"(dict\.__repr__ of ).*")
      file_trace, stream_trace = regdict.sub(
          r"\1{}>", file_trace
      ), regdict.sub(r"\1{}>", stream_trace)
      assert file_trace == stream_trace
  
file_path: dill/dill/tests/test_logger.py
imports: import logging
  import re
  import tempfile
  import dill
  from dill import detect
  from dill.logger import stderr_handler, adapter
label_desc: Use image node_id 2 for calling a global function with example usage: test_trace_to_file(stream_trace) without return types