Back to index

python3.2  3.2.2
Public Member Functions
test.test_concurrent_futures.AsCompletedTests Class Reference
Inheritance diagram for test.test_concurrent_futures.AsCompletedTests:
Inheritance graph
[legend]

List of all members.

Public Member Functions

def test_no_timeout
def test_zero_timeout

Detailed Description

Definition at line 288 of file test_concurrent_futures.py.


Member Function Documentation

Definition at line 290 of file test_concurrent_futures.py.

00290 
00291     def test_no_timeout(self):
00292         future1 = self.executor.submit(mul, 2, 21)
00293         future2 = self.executor.submit(mul, 7, 6)
00294 
00295         completed = set(futures.as_completed(
00296                 [CANCELLED_AND_NOTIFIED_FUTURE,
00297                  EXCEPTION_FUTURE,
00298                  SUCCESSFUL_FUTURE,
00299                  future1, future2]))
00300         self.assertEqual(set(
00301                 [CANCELLED_AND_NOTIFIED_FUTURE,
00302                  EXCEPTION_FUTURE,
00303                  SUCCESSFUL_FUTURE,
00304                  future1, future2]),
00305                 completed)

Here is the call graph for this function:

Definition at line 306 of file test_concurrent_futures.py.

00306 
00307     def test_zero_timeout(self):
00308         future1 = self.executor.submit(time.sleep, 2)
00309         completed_futures = set()
00310         try:
00311             for future in futures.as_completed(
00312                     [CANCELLED_AND_NOTIFIED_FUTURE,
00313                      EXCEPTION_FUTURE,
00314                      SUCCESSFUL_FUTURE,
00315                      future1],
00316                     timeout=0):
00317                 completed_futures.add(future)
00318         except futures.TimeoutError:
00319             pass
00320 
00321         self.assertEqual(set([CANCELLED_AND_NOTIFIED_FUTURE,
00322                               EXCEPTION_FUTURE,
00323                               SUCCESSFUL_FUTURE]),
00324                          completed_futures)
00325 

Here is the call graph for this function:


The documentation for this class was generated from the following file: