def test_withCountIntervalZeroDelay(self):
        """
        L{task.LoopingCall.withCount} with interval set to 0 and a delayed
        call during the loop run will still call the countCallable 1 as if
        no delay occurred.
        """
        clock = task.Clock()
        deferred = defer.Deferred()
        accumulator = []

        def foo(cnt):
            accumulator.append(cnt)

            if len(accumulator) == 2:
                return deferred

            if len(accumulator) > 4:
                loop.stop()

        loop = task.LoopingCall.withCount(foo)
        loop.clock = clock
        loop.start(0, now=False)

        clock.advance(0)
        # Loop will block at the third call.
        self.assertEqual([1, 1], accumulator)

        # Even if more time pass, the loops is not
        # advanced.
        clock.advance(2)
        self.assertEqual([1, 1], accumulator)

        # Once the waiting call got a result the loop continues without
        # observing any delay in countCallable.
        deferred.callback(None)
        clock.advance(0)
        self.assertEqual([1, 1, 1, 1, 1], accumulator)

        L{task.LoopingCall.withCount} with interval set to 0 and a delayed
        call during the loop run will still call the countCallable 1 as if
        no delay occurred.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_task.py