Handle AnyPointers better as arguments to RPC functions

This commit is contained in:
Jason Paryani
2015-06-08 14:59:21 -07:00
parent 6f1ce8bcc5
commit a4990f0868
4 changed files with 36 additions and 0 deletions

View File

@@ -370,3 +370,16 @@ def test_struct_args():
assert client.bar(a='test', b=1).wait().c == 'test1'
with pytest.raises(capnp.KjException):
assert client.bar('test', 1).wait().c == 'test1'
class TestGeneric(capability.TestGeneric.Server):
def foo(self, a, **kwargs):
return a.as_text() + 'test'
def test_generic():
client = capability.TestGeneric._new_client(TestGeneric())
obj = capnp._MallocMessageBuilder().get_root_as_any()
obj.set_as_text("anypointer_")
assert client.foo(obj).wait().b == 'anypointer_test'