Example #1
0
 def test_iteration(self):
     q = threads.ThreadQueue()
     dr = yield q.call(self._producterator, 2.0)
     self.assertIsInstance(dr, iteration.Deferator)
     for k, d in enumerate(dr):
         y = yield d
         self.assertEqual(y, 2.0 * k)
     yield q.shutdown()
Example #2
0
 def _bogusCall(self, **kw):
     if not hasattr(self, 'q'):
         self.q = threads.ThreadQueue(**kw)
     result = self.q.call(self._divideBy, 1, 0)
     self.msg("Bogus call returns {}", result)
     return result
Example #3
0
 def setUp(self):
     self.q = threads.ThreadQueue()
     self.c = threads.Consumerator(maxThreads=self.maxThreads)
Example #4
0
 def test_iteration_raw(self):
     q = threads.ThreadQueue(raw=True)
     iterator = yield q.call(self._producterator, 2.0)
     for k, y in enumerate(iterator):
         self.assertEqual(y, 2.0 * k)
     yield q.shutdown()
Example #5
0
 def test_basic(self):
     for raw in (True, False):
         q = threads.ThreadQueue(raw=raw)
         y = yield q.call(self._blockingTask, 1.5)
         self.assertEqual(y, 3.0)
         yield q.shutdown()