docstr: Tests if the decorator retries sufficient number of times
docstr_tok: ["Tests","if","the","decorator","retries","sufficient","number","of","times"]
code: def test_retry_with_wait(self) -> None:
      """
      Tests if the decorator retries sufficient number of times
      """
  
      class DecoratorTester:
          def __init__(self) -> None:
              self.start_time = time.time()
  
          @retry_on_exception(retries=4, initial_wait_seconds=1)
          def error_throwing_function(self) -> None:
              # The call below will succeed only on the 3rd try
              return self.succeed_after_five_seconds()
  
          @retry_on_exception(retries=4)
          def no_wait_error_throwing_function(self) -> None:
              # The call below will succeed only on the 3rd try
              return self.succeed_after_five_seconds()
  
          def succeed_after_five_seconds(self) -> None:
              if time.time() - self.start_time < 5:
                  raise RuntimeError(
                      "This error surfacing means enough retries were not done"
                  )
              else:
                  return "SUCCESS"
  
      decorator_tester = DecoratorTester()
      self.assertEqual(
          "SUCCESS", decorator_tester.error_throwing_function()
      )
  
      decorator_tester = DecoratorTester()
      with self.assertRaises(RuntimeError):
          decorator_tester.no_wait_error_throwing_function()
  
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 7 for calling the TestRetryDecorator obj's underlying member method code with example usage: obj.test_retry_with_wait() and returns: self, self, str