Properly join list of methods in _DynamicCapabilityClient
This was already fixed in c9bea05f44, but the fix does not seem to work.
This commit uses a set union, which should be more robust. It also adds
a couple of assertions to verify that it indeed works.
This commit is contained in:
committed by
Jacob Alexander
parent
c9bea05f44
commit
42665a61c9
@@ -2199,7 +2199,7 @@ cdef class _DynamicCapabilityClient:
|
|||||||
return self._cached_schema
|
return self._cached_schema
|
||||||
|
|
||||||
def __dir__(self):
|
def __dir__(self):
|
||||||
return list(set(self.schema.method_names_inherited + tuple(dir(self.__class__))))
|
return list(set(self.schema.method_names_inherited) | set(dir(self.__class__)))
|
||||||
|
|
||||||
|
|
||||||
cdef class _CapabilityClient:
|
cdef class _CapabilityClient:
|
||||||
|
|||||||
@@ -51,6 +51,13 @@ async def test_simple_rpc_bootstrap():
|
|||||||
cap = client.bootstrap()
|
cap = client.bootstrap()
|
||||||
cap = cap.cast_as(test_capability_capnp.TestInterface)
|
cap = cap.cast_as(test_capability_capnp.TestInterface)
|
||||||
|
|
||||||
|
# Check not only that the methods are there, but also that they are listed
|
||||||
|
# as expected.
|
||||||
|
assert "foo" in dir(cap)
|
||||||
|
assert "bar" in dir(cap)
|
||||||
|
assert "buz" in dir(cap)
|
||||||
|
assert "bam" in dir(cap)
|
||||||
|
|
||||||
remote = cap.foo(i=5)
|
remote = cap.foo(i=5)
|
||||||
response = await remote
|
response = await remote
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user