類中重寫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)
?