From e5820c6b5dcaa284835f86c95f4455082b842b63 Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Tue, 22 Mar 2011 09:11:39 -0700 Subject: [PATCH 1/2] Issue #11625: Fix Typo --- Doc/library/collections.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst index 260de6c3e6f..b52868e84b7 100644 --- a/Doc/library/collections.rst +++ b/Doc/library/collections.rst @@ -1,3 +1,4 @@ + :mod:`collections` --- Container datatypes ========================================== @@ -993,7 +994,7 @@ Notes on using :class:`Set` and :class:`MutableSet` as a mixin: That assumption is factored-out to an internal classmethod called :meth:`_from_iterable` which calls ``cls(iterable)`` to produce a new set. If the :class:`Set` mixin is being used in a class with a different - constructor signature, you will need to override :meth:`from_iterable` + constructor signature, you will need to override :meth:`_from_iterable` with a classmethod that can construct new instances from an iterable argument. From 8e5e942c594aa29351cdc8ce5802159700cd2dc6 Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Tue, 22 Mar 2011 18:30:30 +0100 Subject: [PATCH 2/2] Use shorter timings in test_concurrent_futures to make it a bit faster (it's still very slow) --- Lib/test/test_concurrent_futures.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Lib/test/test_concurrent_futures.py b/Lib/test/test_concurrent_futures.py index 06cdf0b0e82..f639eec9e5a 100644 --- a/Lib/test/test_concurrent_futures.py +++ b/Lib/test/test_concurrent_futures.py @@ -155,7 +155,7 @@ def test_del_shutdown(self): class WaitTests(unittest.TestCase): def test_first_completed(self): future1 = self.executor.submit(mul, 21, 2) - future2 = self.executor.submit(time.sleep, 5) + future2 = self.executor.submit(time.sleep, 1.5) done, not_done = futures.wait( [CANCELLED_FUTURE, future1, future2], @@ -165,7 +165,7 @@ def test_first_completed(self): self.assertEqual(set([CANCELLED_FUTURE, future2]), not_done) def test_first_completed_some_already_completed(self): - future1 = self.executor.submit(time.sleep, 2) + future1 = self.executor.submit(time.sleep, 1.5) finished, pending = futures.wait( [CANCELLED_AND_NOTIFIED_FUTURE, SUCCESSFUL_FUTURE, future1], @@ -178,8 +178,8 @@ def test_first_completed_some_already_completed(self): def test_first_exception(self): future1 = self.executor.submit(mul, 2, 21) - future2 = self.executor.submit(sleep_and_raise, 5) - future3 = self.executor.submit(time.sleep, 10) + future2 = self.executor.submit(sleep_and_raise, 1.5) + future3 = self.executor.submit(time.sleep, 3) finished, pending = futures.wait( [future1, future2, future3], @@ -190,7 +190,7 @@ def test_first_exception(self): def test_first_exception_some_already_complete(self): future1 = self.executor.submit(divmod, 21, 0) - future2 = self.executor.submit(time.sleep, 5) + future2 = self.executor.submit(time.sleep, 1.5) finished, pending = futures.wait( [SUCCESSFUL_FUTURE, @@ -235,14 +235,14 @@ def test_all_completed(self): def test_timeout(self): future1 = self.executor.submit(mul, 6, 7) - future2 = self.executor.submit(time.sleep, 10) + future2 = self.executor.submit(time.sleep, 3) finished, pending = futures.wait( [CANCELLED_AND_NOTIFIED_FUTURE, EXCEPTION_FUTURE, SUCCESSFUL_FUTURE, future1, future2], - timeout=5, + timeout=1.5, return_when=futures.ALL_COMPLETED) self.assertEqual(set([CANCELLED_AND_NOTIFIED_FUTURE, @@ -332,8 +332,8 @@ def test_map_timeout(self): results = [] try: for i in self.executor.map(time.sleep, - [0, 0, 10], - timeout=5): + [0, 0, 3], + timeout=1.5): results.append(i) except futures.TimeoutError: pass