def test_raising_custom_attribute_error(self):
        # Very similar to
        # test_descr_jy.TestDescrTestCase.test_raising_custom_attribute_error
        class BarAttributeError(AttributeError): pass

        class Bar(object):
            def __getattr__(self, name):
                raise BarAttributeError

        class BarClassic:
            def __getattr__(self, name):
                raise BarAttributeError

        class Foo(object):
            def __getattr__(self, name):
                raise AttributeError("Custom message")

        class FooClassic:
            def __getattr__(self, name):
                raise AttributeError("Custom message")

        self.assertRaises(BarAttributeError, lambda: Bar().x)
        self.assertRaises(BarAttributeError, lambda: BarClassic().x)

        try:
            Foo().x
            self.assert_(False) # Previous line should raise AttributteError
        except AttributeError, e:
            self.assertEquals("Custom message", str(e))

        try:
            FooClassic().x
            self.assert_(False) # Previous line should raise AttributteError
        except __HOLE__, e:
            self.assertEquals("Custom message", str(e))
dataset/ETHPy150Open babble/babble/include/jython/Lib/test/test_descr_jy.py/GetAttrTestCase.test_raising_custom_attribute_error