Commit 28bae6ed authored by Denis Bilenko's avatar Denis Bilenko

test__pool.py: add another test case for imap_unordered

--HG--
extra : transplant_source : %04t%17%8A%C0%C3%FB%EEU9%3C%1B%DAl1-%9A%8A%2A%8A
parent 2f74d6a6
......@@ -251,6 +251,19 @@ class TestPool(greentest.TestCase):
kill()
assert kill.elapsed < 0.5, kill.elapsed
def sleep(self, x):
gevent.sleep(float(x) / 10.)
return str(x)
def test_imap_unordered_sleep(self):
# testing that imap_unordered returns items in competion order
result = list(self.pool.imap_unordered(self.sleep, [10, 1, 2]))
if self.pool.size == 1:
expected = ['10', '1', '2']
else:
expected = ['1', '2', '10']
self.assertEqual(result, expected)
class TestPool2(TestPool):
size = 2
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment