示例#1
0
 def test_add_done_callback(self):
     done_callbacks = []
     with ThreadPoolExecutor(max_workers=1) as executor:
         future = executor.submit(return_call_args, 'foo', biz='baz')
         wrapped_future = ExecutorFuture(future)
         wrapped_future.add_done_callback(
             FunctionContainer(done_callbacks.append, 'called'))
     self.assertEqual(done_callbacks, ['called'])
示例#2
0
 def test_add_done_callback(self):
     done_callbacks = []
     with ThreadPoolExecutor(max_workers=1) as executor:
         future = executor.submit(return_call_args, 'foo', biz='baz')
         wrapped_future = ExecutorFuture(future)
         wrapped_future.add_done_callback(
             FunctionContainer(done_callbacks.append, 'called'))
     self.assertEqual(done_callbacks, ['called'])
示例#3
0
 def test_done(self):
     with ThreadPoolExecutor(max_workers=1) as executor:
         future = executor.submit(return_call_args, 'foo', biz='baz')
         wrapped_future = ExecutorFuture(future)
     self.assertTrue(wrapped_future.done())
示例#4
0
 def test_result(self):
     with ThreadPoolExecutor(max_workers=1) as executor:
         future = executor.submit(return_call_args, 'foo', biz='baz')
         wrapped_future = ExecutorFuture(future)
     self.assertEqual(wrapped_future.result(), (('foo',), {'biz': 'baz'}))
示例#5
0
 def test_done(self):
     with ThreadPoolExecutor(max_workers=1) as executor:
         future = executor.submit(return_call_args, 'foo', biz='baz')
         wrapped_future = ExecutorFuture(future)
     self.assertTrue(wrapped_future.done())
示例#6
0
 def test_result(self):
     with ThreadPoolExecutor(max_workers=1) as executor:
         future = executor.submit(return_call_args, 'foo', biz='baz')
         wrapped_future = ExecutorFuture(future)
     self.assertEqual(wrapped_future.result(), (('foo', ), {'biz': 'baz'}))