

def testPersistenceOfInstanceValues(self):
    s = Gaffer.ScriptNode()
    s['n'] = GafferTest.AddNode()
    Gaffer.Metadata.registerNodeValue(s['n'], 'persistent1', 1)
    Gaffer.Metadata.registerNodeValue(s['n'], 'persistent2', 2, persistent=True)
    Gaffer.Metadata.registerNodeValue(s['n'], 'nonpersistent', 3, persistent=False)
    Gaffer.Metadata.registerPlugValue(s['n']['op1'], 'persistent1', 'one')
    Gaffer.Metadata.registerPlugValue(s['n']['op1'], 'persistent2', 'two', persistent=True)
    Gaffer.Metadata.registerPlugValue(s['n']['op1'], 'nonpersistent', 'three', persistent=False)
    self.assertEqual(Gaffer.Metadata.nodeValue(s['n'], 'persistent1'), 1)
    self.assertEqual(Gaffer.Metadata.nodeValue(s['n'], 'persistent2'), 2)
    self.assertEqual(Gaffer.Metadata.nodeValue(s['n'], 'nonpersistent'), 3)
    self.assertEqual(Gaffer.Metadata.plugValue(s['n']['op1'], 'persistent1'), 'one')
    self.assertEqual(Gaffer.Metadata.plugValue(s['n']['op1'], 'persistent2'), 'two')
    self.assertEqual(Gaffer.Metadata.plugValue(s['n']['op1'], 'nonpersistent'), 'three')
    s2 = Gaffer.ScriptNode()
    s2.execute(s.serialise())
    self.assertEqual(Gaffer.Metadata.nodeValue(s2['n'], 'persistent1'), 1)
    self.assertEqual(Gaffer.Metadata.nodeValue(s2['n'], 'persistent2'), 2)
    self.assertEqual(Gaffer.Metadata.nodeValue(s2['n'], 'nonpersistent'), None)
    s.assertEqual(Gaffer.Metadata.plugValue(s2['n']['op1'], 'persistent1'), 'one')
    self.assertEqual(Gaffer.Metadata.plugValue(s2['n']['op1'], 'persistent2'), 'two')
    self.assertEqual(Gaffer.Metadata.plugValue(s2['n']['op1'], 'nonpersistent'), None)

dataset/ETHPy150Open ImageEngine/gaffer/python/GafferTest/MetadataTest.py MetadataTest.testPersistenceOfInstanceValues/VarMisuse@367/558 `self`->`s`