

def test(self):
    sphere = IECore.SpherePrimitive()
    input = GafferSceneTest.CompoundObjectSource()
    input['in'].setValue(IECore.CompoundObject({
        'bound': IECore.Box3fData(sphere.bound()),
        'children': {
            'ball1': {
                'object': sphere,
                'bound': IECore.Box3fData(sphere.bound()),
            },
            'ball2': {
                'object': sphere,
                'bound': IECore.Box3fData(sphere.bound()),
            },
        },
    }))
    a = GafferScene.CustomAttributes()
    a['in'].setInput(input['out'])
    input.assertEqual(a['out'].attributes('/'), IECore.CompoundObject())
    self.assertEqual(a['out'].attributes('/ball1'), IECore.CompoundObject())
    self.assertEqual(a['out'].attributes('/ball2'), IECore.CompoundObject())
    a['attributes'].addMember('ri:shadingRate', IECore.FloatData(0.25))
    self.assertEqual(a['out'].attributes('/'), IECore.CompoundObject())
    self.assertEqual(a['out'].attributes('/ball1'), IECore.CompoundObject({
        'ri:shadingRate': IECore.FloatData(0.25),
    }))
    self.assertEqual(a['out'].attributes('/ball2'), IECore.CompoundObject({
        'ri:shadingRate': IECore.FloatData(0.25),
    }))
    f = GafferScene.PathFilter()
    f['paths'].setValue(IECore.StringVectorData(['/ball1']))
    a['filter'].setInput(f['out'])
    self.assertEqual(a['out'].attributes('/'), IECore.CompoundObject())
    self.assertEqual(a['out'].attributes('/ball1'), IECore.CompoundObject({
        'ri:shadingRate': IECore.FloatData(0.25),
    }))
    self.assertEqual(a['out'].attributes('/ball2'), IECore.CompoundObject())

dataset/ETHPy150Open ImageEngine/gaffer/python/GafferSceneTest/CustomAttributesTest.py CustomAttributesTest.test/VarMisuse@137/198 `self`->`input`