lib.wiring: ensure flipped(flipped(intf)) is intf.

This commit is contained in:
Catherine 2023-09-01 05:26:59 +00:00
parent 5a17f94fdc
commit f28b20fc84
2 changed files with 5 additions and 1 deletions

View file

@ -552,6 +552,9 @@ class FlippedInterface:
def flipped(interface):
if type(interface) is FlippedInterface:
return interface._FlippedInterface__unflipped
else:
return FlippedInterface(interface)

View file

@ -530,6 +530,7 @@ class FlippedInterfaceTestCase(unittest.TestCase):
self.assertEqual(tintf, flipped(intf))
self.assertRegex(repr(tintf),
r"^flipped\(<.+?\.Interface object at .+>\)$")
self.assertIs(flipped(tintf), intf)
def test_getattr_setattr(self):
class I(Interface):