'test interactions between base-class hooks and subclass hooks'

def testSubHook(self):

    sub = SubClass()
    self.assertEqual(sub.calledSub, 0)
    self.assertEqual(sub.calledBase, 0)
    sub.func(1, b=2)
    self.assertEqual(sub.calledSub, 1)
    self.assertEqual(sub.calledBase, 1)
    hook.addPre(SubClass, 'func', subPre)
    self.assertEqual(sub.calledSub, 1)
    self.assertEqual(sub.calledBase, 1)
    self.assertEqual(sub.calledSubPre, 0)
    self.assertEqual(sub.calledBasePre, 0)
    sub.func(1, b=2)
    self.assertEqual(sub.calledSub, 2)
    self.assertEqual(sub.calledBase, 2)
    self.assertEqual(sub.calledSubPre, 1)
    self.assertEqual(sub.calledBasePre, 0)
    hook.addPre(BaseClass, 'func', basePre)
    BaseClass.func(sub, 1, b=2)
    self.assertEqual(sub.calledBase, 3)
    self.assertEqual(sub.calledBasePre, 1, str(sub.calledBasePre))
    sub.func(1, b=2)
    self.assertEqual(sub.calledBasePre, 2)
    self.assertEqual(sub.calledBase, 4)
    self.assertEqual(sub.calledSubPre, 2)
    self.assertEqual(sub.calledSub, 3)
