[Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless/unittests test_tasklet_become.py, 1.2, 1.3
Dinu Gherman
gherman at centera.de
Thu Apr 22 08:24:31 CEST 2004
Update of /home/cvs/slpdev/src/2.3/dev/Stackless/unittests
In directory centera.de:/tmp/cvs-serv11342
Modified Files:
test_tasklet_become.py
Log Message:
Made kind of working in silent mode. Replaced tabs.
Index: test_tasklet_become.py
===================================================================
RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/unittests/test_tasklet_become.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** test_tasklet_become.py 18 Apr 2004 14:00:30 -0000 1.2
--- test_tasklet_become.py 22 Apr 2004 06:24:29 -0000 1.3
***************
*** 1,36 ****
import unittest
! """Unsure, if an explicit tasklet.become(tasklet()) should be tested. """
- from sys import stdout
- from stackless import *
class TestTaskletBecome(unittest.TestCase):
! def testSimpleTaskletBecome(self):
! def f(ch):
! print "\tBecoming a tasklet inside f(ch)"
! #become_tasklet()
! got = tasklet().capture(42)
! yum = repr(got)
! print "\tCaptured inside f(ch):", yum
! print "message received: " + ch.receive()
! print "\tFunction f(ch) finished"
! ch = channel()
! print
! print "First in main(TestTaskletBecome):",
! foo = getcurrent()
! print foo
! print "Now calling a function f(ch)"
! bar = f(ch)
! print "Back in main(TestTaskletBecome):",bar
! ch.send("Did it work out right?")
! self.assertEquals(42,bar)
if __name__ == '__main__':
! import sys
! if not sys.argv[1:]:
! sys.argv.append('-v')
! unittest.main()
!
!
--- 1,39 ----
+ """Unsure, if an explicit tasklet.become(tasklet()) should be tested."""
+
import unittest
! import sys
! from stackless import tasklet, channel, getcurrent
!
! VERBOSE = False
class TestTaskletBecome(unittest.TestCase):
! def testSimpleTaskletBecome(self):
! def f(ch):
! if VERBOSE: print "\tBecoming a tasklet inside f(ch)"
! #become_tasklet()
! got = tasklet().capture(42)
! yum = repr(got)
! res = ch.receive()
! if VERBOSE:
! print "\tCaptured inside f(ch):", yum
! print "message received: " + res
! print "\tFunction f(ch) finished"
! ch = channel()
! if VERBOSE:
! print
! print "First in main(TestTaskletBecome):",
! foo = getcurrent()
! if VERBOSE:
! print foo
! print "Now calling a function f(ch)"
! bar = f(ch)
! if VERBOSE: print "Back in main(TestTaskletBecome):", bar
! ch.send("Did it work out right?")
! self.assertEquals(42, bar)
if __name__ == '__main__':
! if not sys.argv[1:]: sys.argv.append('-v')
! unittest.main()
_______________________________________________
Stackless-checkins mailing list
Stackless-checkins at stackless.com
http://www.stackless.com/mailman/listinfo/stackless-checkins
More information about the Stackless-checkins
mailing list