class_docstr: Unit tests specific to retry decorator.
class_docstr_tok: ["Unit","tests","specific","to","retry","decorator","."]
docstr: Test that if retryFilter is specified and exception is in
  retryExceptions, retries iff retryFilter returns true.
docstr_tok: ["Test","that","if","retryFilter","is","specified","and","exception","is","in","retryExceptions",",","retries","iff","retryFilter","returns","true","."]
code: def testRetryRetryFilter(self, mockTime, mockSleep):
      """Test that if retryFilter is specified and exception is in
      retryExceptions, retries iff retryFilter returns true."""
  
      self.mockSleepTime(mockTime, mockSleep)
  
      # Test with retryFilter returning True
  
      retryDecoratorTrueFilter = decorators.retry(
          timeoutSec=1,
          initialRetryDelaySec=1,
          maxRetryDelaySec=10,
          retryExceptions=(TestParentException,),
          retryFilter=lambda _1, _2, _3: True,
      )
  
      @retryDecoratorTrueFilter
      def testFunctionTrue():
          raise TestChildException("Test exception")
  
      with self.assertRaises(TestChildException):
          testFunctionTrue()
  
      self.assertEqual(mockSleep.call_count, 1)
  
      # Test with retryFilter returning False
  
      mockSleep.reset_mock()
  
      retryDecoratorFalseFilter = decorators.retry(
          timeoutSec=1,
          initialRetryDelaySec=1,
          maxRetryDelaySec=10,
          retryExceptions=(TestParentException,),
          retryFilter=lambda _1, _2, _3: False,
      )
  
      @retryDecoratorFalseFilter
      def testFunctionFalse():
          raise TestChildException("Test exception")
  
      with self.assertRaises(TestChildException):
          testFunctionFalse()
  
      self.assertEqual(mockSleep.call_count, 0)
  
imports: from mock import patch, call, Mock
  from nupic.support.unittesthelpers.testcasebase import unittest
  from nupic.support import decorators
label_desc: Use image node_id 6 for calling the RetryDecoratorTest obj's underlying member method code with example usage: obj.testRetryRetryFilter(mockTime, mockSleep) without return types