

def testUserPlugMetadata(self):
    s = Gaffer.ScriptNode()
    s['r'] = Gaffer.Reference()
    s['r']['user']['p'] = Gaffer.IntPlug(flags=(Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic))
    Gaffer.Metadata.registerPlugValue(s['r']['user'], 'testPersistent', 1, persistent=True)
    Gaffer.Metadata.registerPlugValue(s['r']['user'], 'testNonPersistent', 2, persistent=False)
    Gaffer.Metadata.registerPlugValue(s['r']['user']['p'], 'testPersistent', 3, persistent=True)
    Gaffer.Metadata.registerPlugValue(s['r']['user']['p'], 'testNonPersistent', 4, persistent=False)
    self.assertEqual(Gaffer.Metadata.plugValue(s['r']['user'], 'testPersistent'), 1)
    self.assertEqual(Gaffer.Metadata.plugValue(s['r']['user'], 'testNonPersistent'), 2)
    self.assertEqual(Gaffer.Metadata.plugValue(s['r']['user']['p'], 'testPersistent'), 3)
    self.assertEqual(Gaffer.Metadata.plugValue(s['r']['user']['p'], 'testNonPersistent'), 4)
    s2 = Gaffer.ScriptNode()
    s2.execute(s.serialise())
    self.assertEqual(Gaffer.Metadata.plugValue(s2['r']['user'], 'testPersistent'), 1)
    self.assertEqual(Gaffer.Metadata.plugValue(s2['r']['user'], 'testNonPersistent'), None)
    self.assertEqual(Gaffer.Metadata.plugValue(s2['r']['user']['p'], 'testPersistent'), 3)
    self.assertEqual(Gaffer.Metadata.plugValue(s2['r']['user']['p'], 'testNonPersistent'), None)

dataset/ETHPy150Open ImageEngine/gaffer/python/GafferTest/ReferenceTest.py ReferenceTest.testUserPlugMetadata/original