

def test_raises_expected_exception(self, sleep_mock):
    retry = retrying.Retry(max_attempts=10, expected_exceptions=[KeyError])

    @retry
    def func():
        raise KeyError()
    self.assertRaises(KeyError, func)
    self.assertEqual(retry.attempt, 1)
    self.assertFalse(sleep_mock.called)

dataset/ETHPy150Open MirantisWorkloadMobility/CloudFerry/tests/lib/utils/test_retrying.py RetryTestCase.test_raises_expected_exception/original