def testAttributMapping(self):
        f = Foo(1)
        self.assertEqual(Foo.name, 'Foo')
        self.assertEqual(f.name, 'Foo')
        name, prototype, apply, constructor = f.call('bAr')
        self.assertEqual(name, 'BAR')
        self.assertEqual(prototype, 'Foo')
        self.assertEqual(apply, 'foo')
        self.assertEqual(constructor, 'Foo')
        self.assertEqual(Foo.label, 'label')
        self.assertEqual(f.label, 'label')
        self.assertEqual(f.do(), 'do')
        self.assertEqual(getattr(f, 'do')(), 'do')
        setattr(Foo, 'typeof', 1)
        self.assertEqual(getattr(f, 'typeof'), 1)
        try:
            self.assertEqual(f.typeof, 1)
        except __HOLE__, e:
            self.fail("Bug #402 setattr error for keywords")
        self.assertTrue(hasattr(Foo, 'typeof'))
        delattr(Foo, 'typeof')
        self.assertFalse(hasattr(Foo, 'typeof'))
        setattr(Foo, 'typeof', 2)
        self.assertTrue(hasattr(Foo, 'typeof'))
        del Foo.typeof
        self.assertFalse(hasattr(Foo, 'typeof'))

        o = object()
        self.assertFalse(hasattr(o, 'name'), "hasattr(o, 'name') should be False")
        self.assertFalse(getattr(o, 'name', False))
dataset/ETHPy150Open pyjs/pyjs/examples/libtest/AttributeTest.py/AttributeTest.testAttributMapping