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_mechanism(self) -> None:
      """
      Tests if the decorator retries sufficient number of times
      """
  
      class DecoratorTester:
          def __init__(self) -> None:
              self.retries_done = 0
  
          @retry_on_exception(retries=4)
          def error_throwing_function(self) -> None:
              # The call below will succeed only on the 3rd try
              return self.succeed_on_3rd_try()
  
          def succeed_on_3rd_try(self) -> None:
              if self.retries_done < 2:
                  self.retries_done += 1
                  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()
      )
  
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 6 for calling the TestRetryDecorator obj's underlying member method code with example usage: obj.test_retry_mechanism() and returns: self, str