@@ -598,6 +598,38 @@ def create(self, *, path=()):
598
598
flipped_interface = CustomSignature ({}).flip ().create ()
599
599
self .assertTrue (hasattr (flipped_interface , "custom_method" ))
600
600
601
+ def test_propagate_flipped (self ):
602
+ class InterfaceWithFlippedSub (Component ):
603
+ signature = Signature ({
604
+ "a" : In (Signature ({
605
+ "b" : Out (Signature ({
606
+ "c" : Out (1 )
607
+ })),
608
+ "d" : In (Signature ({
609
+ "e" : Out (1 )
610
+ })),
611
+ "f" : Out (1 )
612
+ }))
613
+ })
614
+
615
+ def __init__ (self ):
616
+ super ().__init__ ()
617
+ self .g = Signature ({"h" : In (1 )})
618
+
619
+ ifsub = InterfaceWithFlippedSub ()
620
+ self .assertIsInstance (ifsub .a .b .signature , FlippedSignature )
621
+ self .assertIsInstance (ifsub .a .d .signature , Signature )
622
+ self .assertIsInstance (ifsub .signature .members ["a" ].signature .
623
+ members ["b" ].signature , FlippedSignature )
624
+ self .assertIsInstance (ifsub .signature .members ["a" ].signature .
625
+ members ["d" ].signature , Signature )
626
+ self .assertIsInstance (ifsub .a .f , Signal )
627
+ self .assertEqual (ifsub .signature .members ["a" ].signature .
628
+ members ["f" ].flow , In )
629
+ self .assertIsInstance (flipped (ifsub ).g , Signature )
630
+ self .assertEqual (ifsub .g .members ["h" ].flow , In )
631
+ self .assertEqual (flipped (ifsub ).g .members ["h" ].flow , In )
632
+
601
633
602
634
class ConnectTestCase (unittest .TestCase ):
603
635
def test_arg_handles_and_signature_attr (self ):
0 commit comments