

def testErrorTolerantLoading(self):
    s = Gaffer.ScriptNode()
    s['b'] = Gaffer.Box()
    s['b']['s'] = GafferTest.SphereNode()
    s['b']['a'] = GafferTest.AddNode()
    s['b'].exportForReference('/tmp/test.grf')
    s2 = Gaffer.ScriptNode()
    s2['r'] = Gaffer.Reference()
    s2['r'].load('/tmp/test.grf')
    self.assertTrue(('a' in s2['r']))
    self.assertTrue(isinstance(s2['r']['a'], GafferTest.AddNode))
    s2['fileName'].setValue('/tmp/test.gfr')
    s2.save()
    del GafferTest.SphereNode
    s3 = Gaffer.ScriptNode()
    s3['fileName'].setValue('/tmp/test.gfr')
    with IECore.CapturingMessageHandler() as mh:
        s3.load(continueOnError=True)
    self.assertTrue(len(mh.messages))
    self.assertTrue(('a' in s3['r']))
    self.assertTrue(isinstance(s3['r']['a'], GafferTest.AddNode))

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