#NEWLINE# def testSerialisation( self ) : #NEWLINE# #INDENT# s = Gaffer . ScriptNode ( ) #NEWLINE# s [ 'm1' ] = GafferTest . MultiplyNode ( ) #NEWLINE# s [ 'm1' ] [ 'op1' ] . setValue ( 10 ) #NEWLINE# s [ 'm1' ] [ 'op2' ] . setValue ( 20 ) #NEWLINE# s [ 'm2' ] = GafferTest . MultiplyNode ( ) #NEWLINE# s [ 'm2' ] [ 'op2' ] . setValue ( 1 ) #NEWLINE# s [ 'e' ] = Gaffer . Expression ( ) #NEWLINE# s [ 'e' ] . setExpression ( 'parent["m2"]["op1"] = parent["m1"]["product"] * 2' , 'python' ) #NEWLINE# self . assertEqual ( s [ 'm2' ] [ 'product' ] . getValue ( ) , 400 ) #NEWLINE# self . assertTrue ( s [ 'm2' ] [ 'op1' ] . getInput ( ) . node ( ) . isSame ( s [ 'e' ] ) ) #NEWLINE# ss = s . serialise ( ) #NEWLINE# s2 = Gaffer . ScriptNode ( ) #NEWLINE# s2 . execute ( ss ) #NEWLINE# self . assertEqual ( s2 [ 'm2' ] [ 'product' ] . getValue ( ) , 400 ) #NEWLINE# self . assertTrue ( s2 [ 'm2' ] [ 'op1' ] . getInput ( ) . node ( ) . isSame ( s2 [ 'e' ] ) ) #NEWLINE# self . assertEqual ( s2 [ 'e' ] . getExpression ( ) , ( 'parent["m2"]["op1"] = parent["m1"]["product"] * 2' , 'python' ) )