diff options
Diffstat (limited to 'tests/test_gi.py')
-rw-r--r-- | tests/test_gi.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test_gi.py b/tests/test_gi.py index f6552665..5979d5d0 100644 --- a/tests/test_gi.py +++ b/tests/test_gi.py @@ -1692,6 +1692,22 @@ class TestGClosure(unittest.TestCase): def test_in(self): GIMarshallingTests.gclosure_in(lambda: 42) + def test_in_partial(self): + from functools import partial + + called_args = [] + called_kwargs = {} + + def callback(*args, **kwargs): + called_args.extend(args) + called_kwargs.update(kwargs) + return 42 + + func = partial(callback, 1, 2, 3, foo=42) + GIMarshallingTests.gclosure_in(func) + assert called_args == [1, 2, 3] + assert called_kwargs["foo"] == 42 + def test_pass(self): # test passing a closure between two C calls closure = GIMarshallingTests.gclosure_return() |