#NEWLINE# def testPlugConnectionGadgets( self ) : #NEWLINE# #INDENT# script = Gaffer . ScriptNode ( ) #NEWLINE# script [ 'add1' ] = GafferTest . AddNode ( ) #NEWLINE# script [ 'add2' ] = GafferTest . AddNode ( ) #NEWLINE# script [ 'add3' ] = GafferTest . AddNode ( ) #NEWLINE# script [ 'add4' ] = GafferTest . AddNode ( ) #NEWLINE# script [ 'add2' ] [ 'op1' ] . setInput ( script [ 'add1' ] [ 'sum' ] ) #NEWLINE# script [ 'add3' ] [ 'op1' ] . setInput ( script [ 'add2' ] [ 'sum' ] ) #NEWLINE# script [ 'add4' ] [ 'op2' ] . setInput ( script [ 'add2' ] [ 'sum' ] ) #NEWLINE# g = GafferUI . GraphGadget ( script ) #NEWLINE# c = g . connectionGadgets ( script [ 'add1' ] [ 'sum' ] ) #NEWLINE# self . assertEqual ( len ( c ) , 1 ) #NEWLINE# self . assertTrue ( c [ 0 ] . srcNodule ( ) . plug ( ) . isSame ( script [ 'add1' ] [ 'sum' ] ) ) #NEWLINE# self . assertTrue ( c [ 0 ] . dstNodule ( ) . plug ( ) . isSame ( script [ 'add2' ] [ 'op1' ] ) ) #NEWLINE# c = g . connectionGadgets ( script [ 'add1' ] [ 'sum' ] , excludedNodes = Gaffer . StandardSet ( [ script [ 'add2' ] ] ) ) #NEWLINE# self . assertEqual ( len ( c ) , 0 ) #NEWLINE# c = g . connectionGadgets ( script [ 'add2' ] [ 'sum' ] ) #NEWLINE# self . assertEqual ( len ( c ) , 2 ) #NEWLINE# self . assertTrue ( c [ 0 ] . srcNodule ( ) . plug ( ) . isSame ( script [ 'add2' ] [ 'sum' ] ) ) #NEWLINE# self . assertTrue ( c [ 0 ] . dstNodule ( ) . plug ( ) . isSame ( script [ 'add3' ] [ 'op1' ] ) ) #NEWLINE# self . assertTrue ( c [ 1 ] . srcNodule ( ) . plug ( ) . isSame ( script [ 'add2' ] [ 'sum' ] ) ) #NEWLINE# self . assertTrue ( c [ 1 ] . dstNodule ( ) . plug ( ) . isSame ( script [ 'add4' ] [ 'op2' ] ) ) #NEWLINE# c = g . connectionGadgets ( script [ 'add2' ] [ 'sum' ] , excludedNodes = Gaffer . StandardSet ( [ script [ 'add3' ] ] ) ) #NEWLINE# self . assertEqual ( len ( self ) , 1 ) #NEWLINE# self . assertTrue ( c [ 0 ] . srcNodule ( ) . plug ( ) . isSame ( script [ 'add2' ] [ 'sum' ] ) ) #NEWLINE# self . assertTrue ( c [ 0 ] . dstNodule ( ) . plug ( ) . isSame ( script [ 'add4' ] [ 'op2' ] ) )