code: def test_autologging_warnings_are_redirected_as_expected(
      autolog_function, patch_destination, logger
  ):
      stream = StringIO()
      sys.stderr = stream
  
      with pytest.warns(None) as warnings_record:
          autolog_function(silent=False)
          patch_destination.fn()
  
      # The following types of warnings are rerouted to MLflow's event loggers:
      # 1. All MLflow warnings emitted during patch function execution
      # 2. All warnings emitted during the patch function preamble (before the execution of the
      #    original / underlying function) and postamble (after the execution of the underlying
      #    function)
      # 3. non-MLflow warnings emitted during autologging setup / enablement
      #
      # Accordingly, we expect the following warnings to have been emitted normally: 1. MLflow
      # warnings emitted during autologging enablement, 2. non-MLflow warnings emitted during original
      # / underlying function execution
      warning_messages = {str(w.message) for w in warnings_record}
      assert warning_messages == {
          "enablement warning MLflow",
          "Test warning from OG function",
      }
  
      # Further, We expect MLflow's logging stream to contain content from all warnings emitted during
      # the autologging preamble and postamble and non-MLflow warnings emitted during autologging
      # enablement
      for item in [
          'MLflow autologging encountered a warning: "%s:5: Warning: preamble MLflow warning"',
          'MLflow autologging encountered a warning: "%s:10: Warning: postamble MLflow warning"',
      ]:
          assert item % mlflow.__file__ in stream.getvalue()
      for item in [
          'MLflow autologging encountered a warning: "%s:7: UserWarning: preamble numpy warning"',
          'MLflow autologging encountered a warning: "%s:14: Warning: postamble numpy warning"',
          'MLflow autologging encountered a warning: "%s:30: Warning: enablement warning numpy"',
      ]:
          assert item % np.__file__ in stream.getvalue()
  
imports: import logging
  import sys
  import time
  import warnings
  from concurrent.futures import ThreadPoolExecutor
  from io import StringIO
  import numpy
  import pytest
  import mlflow
  from mlflow.utils.autologging_utils import autologging_integration, safe_patch
  from mlflow.utils.logging_utils import eprint
  from tests.autologging.fixtures import patch_destination, reset_stderr, test_mode_off
label_desc: Use image node_id 3 for calling a global function with example usage: test_autologging_warnings_are_redirected_as_expected(autolog_function, patch_destination, logger) without return types