code: def test_executor_context(self):
      view = self.client.load_balanced_view()
      executor = view.executor
      with executor:
          f = executor.submit(time.sleep, 0.5)
          assert not f.done()
          m = executor.map(lambda x: x, range(10))
      assert len(view.history) == 11
      # Executor context calls shutdown
      # shutdown doesn't shutdown engines,
      # but it should at least wait for results to finish
      assert f.done()
      tic = time.perf_counter()
      list(m)
      toc = time.perf_counter()
      assert toc - tic < 0.5
  
file_path: ipyparallel/ipyparallel/tests/test_executor.py
imports: import time
  from ipyparallel.client.view import LazyMapIterator, LoadBalancedView
  from .clienttest import ClusterTestCase
label_desc: Use image node_id 5 for calling the TestExecutor obj's underlying member method code with example usage: obj.test_executor_context() without return types