def testSubHook(self):
        sub = SubClass()
        self.assertEquals(sub.calledSub, 0)
        self.assertEquals(sub.calledBase, 0)
        sub.func(1, b=2)
        self.assertEquals(sub.calledSub, 1)
        self.assertEquals(sub.calledBase, 1)
        hook.addPre(SubClass, 'func', subPre)
        self.assertEquals(sub.calledSub, 1)
        self.assertEquals(sub.calledBase, 1)
        self.assertEquals(sub.calledSubPre, 0)
        self.assertEquals(sub.calledBasePre, 0)
        sub.func(1, b=2)
        self.assertEquals(sub.calledSub, 2)
        self.assertEquals(sub.calledBase, 2)
        self.assertEquals(sub.calledSubPre, 1)
        self.assertEquals(sub.calledBasePre, 0)
        # let the pain begin
        hook.addPre(BaseClass, 'func', basePre)
        BaseClass.func(sub, 1, b=2)
        # sub.func(1, b=2)
        self.assertEquals(sub.calledBase, 3)
        self.assertEquals(sub.calledBasePre, 1, str(sub.calledBasePre))
        sub.func(1, b=2)
        self.assertEquals(sub.calledBasePre, 2)
        self.assertEquals(sub.calledBase, 4)
        self.assertEquals(sub.calledSubPre, 2)
        self.assertEquals(sub.calledSub, 3)
test interactions between base-class hooks and subclass hooks
dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/test/test_hook.py/HookTestCase.testSubHook