

def testDeregisterNodeInstanceValue(self):
    s = Gaffer.ScriptNode()
    s['n'] = GafferTest.AddNode()
    self.assertEqual(Gaffer.Metadata.nodeValue(s['n'], 'deleteMe'), None)
    Gaffer.Metadata.registerNodeValue(GafferTest.AddNode, 'deleteMe', 10)
    self.assertEqual(Gaffer.Metadata.nodeValue(s['n'], 'deleteMe'), 10)
    Gaffer.Metadata.registerNodeValue(s['n'], 'deleteMe', 20)
    self.assertEqual(Gaffer.Metadata.nodeValue(s['n'], 'deleteMe'), 20)
    self.assertTrue(('Metadata' in s.serialise()))
    with Gaffer.UndoContext(s):
        Gaffer.Metadata.deregisterNodeValue(s['n'], 'deleteMe')
        self.assertTrue(('Metadata' not in s.serialise()))
        self.assertEqual(Gaffer.Metadata.nodeValue(s['n'], 'deleteMe'), 10)
    s.undo()
    self.assertEqual(Gaffer.Metadata.nodeValue(s['n'], 'deleteMe'), 20)
    self.assertTrue(('Metadata' in s.serialise()))
    s.redo()
    self.assertEqual(Gaffer.Metadata.nodeValue(s['n'], 'deleteMe'), 10)
    self.assertTrue(('Metadata' not in s.serialise()))
    Gaffer.Metadata.deregisterNodeValue(GafferTest.AddNode, 'deleteMe')
    self.assertEqual(Gaffer.Metadata.nodeValue(s['n'], 'deleteMe'), None)
    self.assertTrue(('Metadata' not in s.serialise()))

dataset/ETHPy150Open ImageEngine/gaffer/python/GafferTest/MetadataTest.py MetadataTest.testDeregisterNodeInstanceValue/original