summaryrefslogtreecommitdiff
path: root/Lib/test/test_concurrent_futures.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2014-01-26 09:57:51 -0800
committerGuido van Rossum <guido@python.org>2014-01-26 09:57:51 -0800
commitb464fedc4bbe40c57690229b78a4b9a6cfe0d18f (patch)
tree43563945e5b78a28b7bd90d7b32a4cc5d9067a70 /Lib/test/test_concurrent_futures.py
parentea9469b940b3349191367e6117966822d7c1e2fb (diff)
downloadcpython-b464fedc4bbe40c57690229b78a4b9a6cfe0d18f.tar.gz
Fix issue #20367: concurrent.futures.as_completed() for duplicate arguments.
Patch by Glenn Langford.
Diffstat (limited to 'Lib/test/test_concurrent_futures.py')
-rw-r--r--Lib/test/test_concurrent_futures.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_concurrent_futures.py b/Lib/test/test_concurrent_futures.py
index a7e945cb5e..c74b2ca6ed 100644
--- a/Lib/test/test_concurrent_futures.py
+++ b/Lib/test/test_concurrent_futures.py
@@ -350,6 +350,13 @@ class AsCompletedTests:
SUCCESSFUL_FUTURE]),
completed_futures)
+ def test_duplicate_futures(self):
+ # Issue 20367. Duplicate futures should not raise exceptions or give
+ # duplicate responses.
+ future1 = self.executor.submit(time.sleep, 2)
+ completed = [f for f in futures.as_completed([future1,future1])]
+ self.assertEqual(len(completed), 1)
+
class ThreadPoolAsCompletedTests(ThreadPoolMixin, AsCompletedTests, unittest.TestCase):
pass