Support _DynamicListReader in _setDynamicField
See the test for an explanation. Note that I'm not sure what the purpose of `_setDynamicFieldWithField` and `_setDynamicFieldStatic` is. It does not appear to be used. I've kept them for now (they are a public API), but perhaps this can be removed.
This commit is contained in:
committed by
Jacob Alexander
parent
aafec2281e
commit
ef5e039067
@@ -28,6 +28,8 @@ interface TestInterface {
|
||||
bar @1 () -> ();
|
||||
buz @2 (i: TestSturdyRefHostId) -> (x: Text);
|
||||
bam @3 (i :UInt32, j :Bool) -> (x: Text, i:UInt32);
|
||||
bak1 @4 () -> (i:List(UInt32));
|
||||
bak2 @5 (i:List(UInt32)) -> ();
|
||||
# baz @2 (s: TestAllTypes);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,12 @@ class Server(capability.TestInterface.Server):
|
||||
async def bam(self, i, **kwargs):
|
||||
return str(i) + "_test", i
|
||||
|
||||
async def bak1(self, **kwargs):
|
||||
return [1, 2, 3, 4, 5]
|
||||
|
||||
async def bak2(self, i, **kwargs):
|
||||
assert i[4] == 5
|
||||
|
||||
|
||||
class PipelineServer(capability.TestPipeline.Server):
|
||||
async def getCap(self, n, inCap, _context, **kwargs):
|
||||
@@ -67,6 +73,12 @@ async def test_client():
|
||||
with pytest.raises(AttributeError):
|
||||
req.baz = 1
|
||||
|
||||
resp = await client.bak1()
|
||||
# Used to fail with
|
||||
# capnp.lib.capnp.KjException: Tried to set field: 'i' with a value of: '[1, 2, 3, 4, 5]'
|
||||
# which is an unsupported type: '<class 'capnp.lib.capnp._DynamicListReader'>'
|
||||
await client.bak2(resp.i)
|
||||
|
||||
|
||||
async def test_simple_client():
|
||||
client = capability.TestInterface._new_client(Server())
|
||||
|
||||
Reference in New Issue
Block a user