def testGetattr(self):
        func = getattr(self, "getName")
        self.assertEqual(func(), "AttributeTest",
                         "getattr does not return correct value'")

        self.assertEqual(getattr(Foo, 'name'),
                        'Foo', "attribute mapping, bug #521")
        self.assertEqual(1, getattr(Foo, "notthere", 1))
        foo = Foo(1)
        self.assertEqual(foo.v, getattr(foo, "v"))
        self.assertEqual(getattr(foo, "v"), getattr(foo, "v"))

        # test on none object type
        self.assertEqual(getattr(1, 'x', 2), 2)
        self.assertEqual(getattr(None, 'x', 2), 2)

        try:
            self.assertEqual(1, getattr(foo, "vv"))
        except __HOLE__, e:
            self.assertEqual(e.__class__.__name__, 'AttributeError')
            return
        self.fail("No AttributeError raised")
dataset/ETHPy150Open pyjs/pyjs/examples/libtest/AttributeTest.py/AttributeTest.testGetattr