lib.wiring: create flipped interface from flipped signature.
Fixes #914. Co-authored-by: Nelson Gauthier <nelson.gauthier@gmail.com>
This commit is contained in:
parent
b871f2ad79
commit
a90bc7b91a
|
@ -535,6 +535,9 @@ class FlippedSignature:
|
|||
def __setattr__(self, name, value):
|
||||
return setattr(self.__unflipped, name, value)
|
||||
|
||||
def create(self, *, path=()):
|
||||
return flipped(self.__unflipped.create(path=path))
|
||||
|
||||
def __repr__(self):
|
||||
return f"{self.__unflipped!r}.flip()"
|
||||
|
||||
|
|
|
@ -584,6 +584,18 @@ class FlippedInterfaceTestCase(unittest.TestCase):
|
|||
r"^flipped\(\) can only flip an interface object, not Signature\({}\)$"):
|
||||
flipped(Signature({}))
|
||||
|
||||
def test_create_subclass_flipped(self):
|
||||
class CustomInterface(Interface):
|
||||
def custom_method(self):
|
||||
return 69
|
||||
|
||||
class CustomSignature(Signature):
|
||||
def create(self, *, path=()):
|
||||
return CustomInterface(self, path=path)
|
||||
|
||||
flipped_interface = CustomSignature({}).flip().create()
|
||||
self.assertTrue(hasattr(flipped_interface, "custom_method"))
|
||||
|
||||
|
||||
class ConnectTestCase(unittest.TestCase):
|
||||
def test_arg_handles_and_signature_attr(self):
|
||||
|
|
Loading…
Reference in a new issue