

def testInstanceMetadataUndo(self):
    s = Gaffer.ScriptNode()
    s['n'] = GafferTest.AddNode()
    self.assertEqual(Gaffer.Metadata.nodeValue(s['n'], 'undoTest'), None)
    self.assertEqual(Gaffer.Metadata.plugValue(s['n']['op1'], 'undoTest'), None)
    with Gaffer.UndoContext(s):
        Gaffer.Metadata.registerNodeValue(s['n'], 'undoTest', 'instanceNodeValue')
        Gaffer.Metadata.registerPlugValue(s['n']['op1'], 'undoTest', 'instancePlugValue')
    self.assertEqual(Gaffer.Metadata.nodeValue(s['n'], 'undoTest'), 'instanceNodeValue')
    self.assertEqual(Gaffer.Metadata.plugValue(s['n']['op1'], 'undoTest'), 'instancePlugValue')
    with Gaffer.UndoContext(s):
        Gaffer.Metadata.registerNodeValue(s['n'], 'undoTest', 'instanceNodeValue2')
        Gaffer.Metadata.registerPlugValue(s['n']['op1'], 'undoTest', 'instancePlugValue2')
    self.assertEqual(Gaffer.Metadata.nodeValue(s['n'], 'undoTest'), 'instanceNodeValue2')
    self.assertEqual(Gaffer.Metadata.plugValue(s['n']['op1'], 'undoTest'), 'instancePlugValue2')
    s.undo()
    self.assertEqual(Gaffer.Metadata.nodeValue(s['n'], 'undoTest'), 'instanceNodeValue')
    self.assertEqual(Gaffer.Metadata.plugValue(s['n']['op1'], 'undoTest'), 'instancePlugValue')
    s.undo()
    self.assertEqual(Gaffer.Metadata.nodeValue(s['n'], 'undoTest'), None)
    self.assertEqual(Gaffer.Metadata.plugValue(s['n']['op1'], 'undoTest'), None)
    s.redo()
    self.assertEqual(Gaffer.Metadata.nodeValue(s['n'], 'undoTest'), 'instanceNodeValue')
    self.assertEqual(Gaffer.Metadata.plugValue(s['n']['op1'], 'undoTest'), 'instancePlugValue')
    s.redo()
    self.assertEqual(Gaffer.Metadata.nodeValue(s['n'], 'undoTest'), 'instanceNodeValue2')
    s.assertEqual(Gaffer.Metadata.plugValue(s['n']['op1'], 'undoTest'), 'instancePlugValue2')

dataset/ETHPy150Open ImageEngine/gaffer/python/GafferTest/MetadataTest.py MetadataTest.testInstanceMetadataUndo/VarMisuse@436/702 `self`->`s`