我似乎无法让 test2 中的 Test1.test_something() 工作..不确定是不是因为它们都继承自同一个基础?
助手.py:
class baseTest(unittest.TestCase):
def setUp(self, param="Something"):
print param
pass
测试1.py
from Helper import baseTest
class test1(baseTest):
def setUp(self):
super(test1, self).setUp('foo')
def test_something(self):
assert 1 == 1, "One does not equal one."
测试2.py
from Helper import baseTest
import Test1
class test2(baseTest):
def setUp(self):
super(test2, self).setUp('bar')
def test_something(self):
Test1.test_somehing()
现在,我以前有这个工作,当我在他们的类中为 test1 和 test2 设置了 setUp 时,但是一旦我让它们都从 baseTest 继承,我开始得到一个unbound method <method> must be called with Test instance as first argument (got nothing instead)
. 有什么建议么?