def test_repeat_call_with_args(self):
        def fail_count_down(*args, **kwargs):
            if fail_count_down.fail_count == 0:
                return (args, kwargs)
            else:
                fail_count_down.fail_count -= 1
                raise TypeError('fail')
        fail_count_down.fail_count = 0

        self.assertEquals(operators.repeat_call(lambda a: a, 0, 'success'), 'success')
        fail_count_down.fail_count = 2
        self.assertEquals(operators.repeat_call(
            fail_count_down,
            2,
            'third',
            a='b'),
            (('third',), {'a': 'b'}))
    def test_repeat_call(self):
        def fail_count_down():
            if fail_count_down.fail_count == 0:
                return 'success'
            else:
                fail_count_down.fail_count -= 1
                raise TypeError('fail')
        fail_count_down.fail_count = 0

        self.assertEquals(operators.repeat_call(lambda: 'success', 0), 'success')
        fail_count_down.fail_count = 1
        self.assertEquals(operators.repeat_call(fail_count_down, 1), 'success')
        with self.assertRaises(TypeError):
            fail_count_down.fail_count = 2
            self.assertEquals(operators.repeat_call(fail_count_down, 1), 'success')
        fail_count_down.fail_count = 5
        self.assertEquals(operators.repeat_call(fail_count_down, 5), 'success')