summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_multiprocessing.py
diff options
context:
space:
mode:
authorHynek Schlawack <hs@ox.cx>2012-10-27 10:56:30 (GMT)
committerHynek Schlawack <hs@ox.cx>2012-10-27 10:56:30 (GMT)
commit969684f2ad340cdfe1c46ba5b40b6668aca1b52b (patch)
tree97126e9f978669f0353aabe298b3738db9ec1f20 /Lib/test/test_multiprocessing.py
parent5979fdf548677a8a6ecc45542f6df640c10d2096 (diff)
parent254af2644a90bcabbe2612950dd2a6ef408337be (diff)
downloadcpython-969684f2ad340cdfe1c46ba5b40b6668aca1b52b.zip
cpython-969684f2ad340cdfe1c46ba5b40b6668aca1b52b.tar.gz
cpython-969684f2ad340cdfe1c46ba5b40b6668aca1b52b.tar.bz2
Merge 3.3
Diffstat (limited to 'Lib/test/test_multiprocessing.py')
-rw-r--r--Lib/test/test_multiprocessing.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/Lib/test/test_multiprocessing.py b/Lib/test/test_multiprocessing.py
index a8e42e4..9c7a202 100644
--- a/Lib/test/test_multiprocessing.py
+++ b/Lib/test/test_multiprocessing.py
@@ -1655,6 +1655,23 @@ class _TestPool(BaseTestCase):
self.assertEqual(self.pool.starmap_async(mul, tuples).get(),
list(itertools.starmap(mul, tuples)))
+ def test_map_async(self):
+ self.assertEqual(self.pool.map_async(sqr, list(range(10))).get(),
+ list(map(sqr, list(range(10)))))
+
+ def test_map_async_callbacks(self):
+ call_args = self.manager.list() if self.TYPE == 'manager' else []
+ self.pool.map_async(int, ['1'],
+ callback=call_args.append,
+ error_callback=call_args.append).wait()
+ self.assertEqual(1, len(call_args))
+ self.assertEqual([1], call_args[0])
+ self.pool.map_async(int, ['a'],
+ callback=call_args.append,
+ error_callback=call_args.append).wait()
+ self.assertEqual(2, len(call_args))
+ self.assertIsInstance(call_args[1], ValueError)
+
def test_map_chunksize(self):
try:
self.pool.map_async(sqr, [], chunksize=1).get(timeout=TIMEOUT1)