# Path: smarkets/greenlet.py
# def cooperative_iter(iterable, chunk_size=1, interval=0):
#     """
#     Returns an iterator which wraps `iterable` and sleeps `interval` every `chunk_size`
#     elements. This makes iterating `iterable` more green and can prevent starving other
#     greenlets/greenthreads.
# 
#     :type iterable: iterable
#     :type chunk_size: int
#     :type interval: float
#     """
# 
#     for index, element in enumerate(iterable):
#         yield element
#         if index % chunk_size == 0:
#             sleep(interval)


from eventlet import spawn
from nose.tools import eq_
from six.moves import xrange
from smarkets.greenlet import cooperative_iter
from __future__ import absolute_import, division, print_function, unicode_literals




def test_cooperative_iter_is_cooperative():
    storage = []

    def process_stuff(identifier, count):

# Path: smarkets/greenlet.py
# def cooperative_iter(iterable, chunk_size=1, interval=0):
#     """
#     Returns an iterator which wraps `iterable` and sleeps `interval` every `chunk_size`
#     elements. This makes iterating `iterable` more green and can prevent starving other
#     greenlets/greenthreads.
# 
#     :type iterable: iterable
#     :type chunk_size: int
#     :type interval: float
#     """
# 
#     for index, element in enumerate(iterable):
#         yield element
#         if index % chunk_size == 0:
#             sleep(interval)


# Path: smarkets/tests/greenlet.py
from eventlet import spawn
from nose.tools import eq_
from six.moves import xrange
from smarkets.greenlet import cooperative_iter

from __future__ import absolute_import, division, print_function, unicode_literals




def test_cooperative_iter_is_cooperative():
    storage = []

    def process_stuff(identifier, count):

        for i in cooperative_iter(xrange(count), interval=0.05):