code: def test_imap_infinite(self):
      view = self.view
  
      source = count()
  
      def task(i):
          import time
  
          time.sleep(0.1)
          return i
  
      gen = view.imap(task, source, max_outstanding=2)
      results = []
      for i in gen:
          results.append(i)
          if i >= 3:
              break
      # stop consuming the iterator
      gen.cancel()
  
      assert len(results) == 4
  
      # wait
      self.client.wait(timeout=self.timeout)
      # verify that max_outstanding wasn't exceeded
      assert 4 <= len(self.view.history) < 10
  
imports: import time
  from itertools import count
  import pytest
  import ipyparallel
  from ipyparallel import error
  from .clienttest import ClusterTestCase, crash, raises_remote
label_desc: Use image node_id 11 for calling the TestLoadBalancedView obj's underlying member method code with example usage: obj.test_imap_infinite() and returns: i