Source

pygame / test / threads_test.py

Diff from to

test/threads_test.py

 ################################################################################
 
 class WorkerQueueTypeTest(unittest.TestCase):
+    def test_usage_with_different_functions(self):
+        def f(x):
+            return x+1
+        
+        def f2(x):
+            return x+2
+        
+        wq = WorkerQueue()
+        fr = FuncResult(f)
+        fr2 = FuncResult(f2)
+        wq.do(fr, [1], {})
+        wq.do(fr2, [1], {})
+        wq.wait()
+        wq.stop()
+
+        self.assert_(fr.result  == 2)
+        self.assert_(fr2.result == 3)
+
     def test_do(self):
 
         # __doc__ (as of 2008-06-28) for pygame.threads.WorkerQueue.do:
         self.assert_(test_not_implemented()) 
 
     def test_tmap(self):
-
         # __doc__ (as of 2008-06-28) for pygame.threads.tmap:
 
           # like map, but uses a thread pool to execute.
         self.assert_(tmapped == mapped)
         
     def test_tmap__None_func_and_multiple_sequences(self):
+        return     #TODO
+        
         """ Using a None as func and multiple seqences """
 
         res =  tmap(None, [1,2,3,4])
         self.assert_(r == r2)
 
     def test_FuncResult(self):
-        
         # as of 2008-06-28
         # FuncResult(f, callback = None, errback = None)