

def testSerialisation(self):
    s = Gaffer.ScriptNode()
    s['n1'] = GafferTest.AddNode()
    s['n2'] = GafferTest.AddNode()
    s['n2']['op1'].setInput(s['n1']['sum'])
    b = Gaffer.Box.create(s, Gaffer.StandardSet([b['n1']]))
    b.promotePlug(b['n1']['op1'])
    b.exportForReference('/tmp/test.grf')
    s = Gaffer.ScriptNode()
    s['r'] = Gaffer.Reference()
    s['r'].load('/tmp/test.grf')
    self.assertTrue(('n1' in s['r']))
    self.assertTrue(s['r']['n1']['op1'].getInput().isSame(s['r']['op1']))
    self.assertTrue(s['r']['sum'].getInput().isSame(s['r']['n1']['sum']))
    s['r']['op1'].setValue(25)
    self.assertEqual(s['r']['sum'].getValue(), 25)
    ss = s.serialise()
    self.assertTrue(('AddNode' not in ss))
    self.assertTrue(('"op1"' in ss))
    s2 = Gaffer.ScriptNode()
    s2.execute(ss)
    self.assertTrue(('n1' in s2['r']))
    self.assertTrue(s2['r']['sum'].getInput().isSame(s2['r']['n1']['sum']))
    self.assertEqual(s2['r']['sum'].getValue(), 25)

dataset/ETHPy150Open ImageEngine/gaffer/python/GafferTest/ReferenceTest.py ReferenceTest.testSerialisation/VarMisuse@74/113 `s`->`b`