given a Python class hierarchy, say
class Base:
def method1
def method2
def method3
...
class Derived1(Base)
class Derived2(Base)
etc.
and given that Base defines some common interface which is re-implemented differently in each Derived class. What would be the most straightforward way to unit test all member functions of all classes. Since i'm having a class hierarchy, i thought of doing something like...
class MyTestCase(unittest.TestCase):
def testMethod1:
## Just as an example. Can be similar
self.failUnless(self.instance.method1())
def testMethod2
...
And then setting up the test suite with test cases for different instantiations of the class hierarchy But how do i get the "instance" parameter into the MyTestCase class?