

def testComponentsWithMetaData(self):
    s = Gaffer.ScriptNode()
    s['n'] = GafferTest.AddNode()
    s['n2'] = GafferTest.AddNode()
    s['n3'] = GafferTest.AddNode()
    s['m'] = GafferTest.MultiplyNode()
    self.assertEqual(Gaffer.Metadata.nodesWithMetadata(s, 'nodeData1'), [])
    Gaffer.Metadata.registerNodeValue(s['n'], 'nodeData1', 'something')
    Gaffer.Metadata.registerNodeValue(s['n2'], 'nodeData2', 'something')
    Gaffer.Metadata.registerNodeValue(s['m'], 'nodeData3', 'something')
    Gaffer.Metadata.registerNodeValue(s['n'], 'nodeData3', 'something')
    Gaffer.Metadata.registerNodeValue(GafferTest.AddNode, 'nodeData3', 'something')
    Gaffer.Metadata.registerPlugValue(s['n']['op1'], 'plugData1', 'something')
    Gaffer.Metadata.registerPlugValue(s['n2']['op2'], 'plugData2', 'something')
    Gaffer.Metadata.registerPlugValue(m['m']['op2'], 'plugData3', 'something')
    Gaffer.Metadata.registerPlugValue(s['m']['op1'], 'plugData3', 'something')
    Gaffer.Metadata.registerPlugValue(GafferTest.AddNode, 'op1', 'plugData3', 'somethingElse')
    self.assertEqual(Gaffer.Metadata.nodesWithMetadata(s, 'nodeData1'), [s['n']])
    self.assertEqual(Gaffer.Metadata.nodesWithMetadata(s, 'nodeData2'), [s['n2']])
    self.assertEqual(Gaffer.Metadata.nodesWithMetadata(s, 'nodeData3'), [s['n'], s['n2'], s['n3'], s['m']])
    self.assertEqual(set(Gaffer.Metadata.nodesWithMetadata(s, 'nodeData3', instanceOnly=True)), set([s['n'], s['m']]))
    self.assertEqual(Gaffer.Metadata.plugsWithMetadata(s, 'nodeData1'), [])
    self.assertEqual(Gaffer.Metadata.plugsWithMetadata(s, 'nodeData3'), [])
    self.assertEqual(Gaffer.Metadata.plugsWithMetadata(s, 'plugData1'), [s['n']['op1']])
    self.assertEqual(Gaffer.Metadata.plugsWithMetadata(s, 'plugData2'), [s['n2']['op2']])
    self.assertEqual(Gaffer.Metadata.plugsWithMetadata(s, 'plugData3'), [s['n']['op1'], s['n2']['op1'], s['n3']['op1'], s['m']['op1'], s['m']['op2']])
    self.assertEqual(set(Gaffer.Metadata.plugsWithMetadata(s, 'plugData3', instanceOnly=True)), set([s['m']['op1'], s['m']['op2']]))
    self.assertEqual(Gaffer.Metadata.nodesWithMetadata(s, 'plugData1'), [])
    self.assertEqual(Gaffer.Metadata.nodesWithMetadata(s, 'plugData3'), [])
    m = s['m']
    s.removeChild(m)
    self.assertEqual(Gaffer.Metadata.plugsWithMetadata(s, 'plugData3', instanceOnly=True), [])
    self.assertEqual(Gaffer.Metadata.nodesWithMetadata(s, 'nodeData3', instanceOnly=True), [s['n']])

dataset/ETHPy150Open ImageEngine/gaffer/python/GafferTest/MetadataTest.py MetadataTest.testComponentsWithMetaData/VarMisuse@204/349 `s`->`m`