类中重写assertEqual便当我重写unittest.TestCase
用我自己的课堂,我想一些额外的功能添加到assertEqual
:类型错误派生
class MyTestCase(unittest.TestCase):
def __init__(self,*args, **kwargs):
unittest.TestCase.__init__(self, *args, **kwargs)
def _write_to_log(self):
print "writing to log..."
def assertEqual(self, first, second, msg=None):
self._write_to_log()
unittest.TestCase.assertEqual(first, second, msg)
但我正在逐渐TypeError: unbound method assertEqual() must be called with TestCase instance as first argument (got int instance instead)
?