docstr: Tests that the decorator works on standalone functions as well as on
  instance methods.
docstr_tok: ["Tests","that","the","decorator","works","on","standalone","functions","as","well","as","on","instance","methods","."]
code: def test_on_function_with_wrapper_message(self) -> None:
      """Tests that the decorator works on standalone functions as well as on
      instance methods.
      """
  
      mock = Mock()
  
      @retry_on_exception(wrap_error_message_in="Wrapper error message")
      # pyre-fixme[53]: Captured variable `mock` is not annotated.
      # pyre-fixme[3]: Return type must be annotated.
      def error_throwing_function():
          mock()
          raise RuntimeError("I failed")
  
      # Check that the function remains non-async.
      self.assertFalse(iscoroutinefunction(error_throwing_function))
  
      with self.assertRaisesRegex(
          RuntimeError, "Wrapper error message: RuntimeError: I failed"
      ):
          error_throwing_function()
  
      self.assertEqual(mock.call_count, 3)
  
file_path: Ax/ax/utils/common/tests/test_executils.py
imports: import logging
  import time
  from asyncio import iscoroutinefunction
  from unittest.mock import Mock
  from ax.utils.common.executils import retry_on_exception
  from ax.utils.common.testutils import TestCase
label_desc: Use image node_id 10 for calling the TestRetryDecorator obj's underlying member method code with example usage: obj.test_on_function_with_wrapper_message() without return types