[pypy-commit] pypy stacklet: Test passing arguments to callbacks.
arigo
noreply at buildbot.pypy.org
Sat Aug 6 12:31:18 CEST 2011
Author: Armin Rigo <arigo at tunes.org>
Branch: stacklet
Changeset: r46312:b419cfdedc8d
Date: 2011-08-06 11:37 +0200
http://bitbucket.org/pypy/pypy/changeset/b419cfdedc8d/
Log: Test passing arguments to callbacks.
diff --git a/pypy/module/_stacklet/test/test_stacklet.py b/pypy/module/_stacklet/test/test_stacklet.py
--- a/pypy/module/_stacklet/test/test_stacklet.py
+++ b/pypy/module/_stacklet/test/test_stacklet.py
@@ -43,3 +43,21 @@
raises(ValueError, newstacklet, empty_callback)
assert len(seen) == 1
assert not seen[0].is_pending()
+
+ def test_callback_with_arguments(self):
+ from _stacklet import newstacklet
+ #
+ def empty_callback(h, *args, **kwds):
+ assert h.is_pending()
+ seen.append(h)
+ seen.append(args)
+ seen.append(kwds)
+ return h
+ #
+ seen = []
+ h = newstacklet(empty_callback, 42, 43, foo=44, bar=45)
+ assert h is None
+ assert len(seen) == 3
+ assert not seen[0].is_pending()
+ assert seen[1] == (42, 43)
+ assert seen[2] == {'foo': 44, 'bar': 45}
More information about the pypy-commit
mailing list