MCPcopy Create free account
hub / github.com/ImageEngine/cortex / test

Method test

test/IECore/IgnoredExceptionsTest.py:43–66  ·  view source on GitHub ↗
( self )

Source from the content-addressed store, hash-verified

41class IgnoredExceptionsTest( unittest.TestCase ) :
42
43 def test( self ) :
44
45 def f( toRaise, toIgnore ) :
46
47 with IECore.IgnoredExceptions( toIgnore ) :
48 raise toRaise
49
50 self.assertRaises( RuntimeError, f, RuntimeError, KeyError )
51 self.assertRaises( RuntimeError, f, RuntimeError, ( KeyError, IndexError ) )
52
53 f( KeyError, KeyError )
54 f( KeyError, ( KeyError, IndexError ) )
55 f( IndexError, ( KeyError, IndexError ) )
56
57 c = IECore.CompoundObject()
58 with IECore.IgnoredExceptions( KeyError ) :
59 c["d"]
60
61 with IECore.IgnoredExceptions( Exception ) :
62 c["d"]
63
64 p = IECore.Parameterised( "" )
65 with IECore.IgnoredExceptions( Exception ) :
66 p["d"]
67
68 def testNoExceptions( self ) :
69

Callers

nothing calls this directly

Calls 2

CompoundObjectMethod · 0.80
ParameterisedMethod · 0.80

Tested by

no test coverage detected