class TestBase(unittest.TestCase):

    def check(self, input, expected_output):
        obj = self.class_under_test(input)
actual_output = obj.get_result()
self.assertEqual(actual_output, expected_output)

def check_all(self):
    for value in self.values:
        self.check(value[0], value[1])


class TestMyClass1(TestBase):
    values = (1, 2), (3, 4)
class_under_test = MyClass1

def test_it(self):
    self.check_all()


class TestMyClass2(TestBase):
    values = ('a', 'b'), ('d', 'e')
class_under_test = MyClass2

def test_it(self):
    self.check_all()
Python unittest TestCase с наследованием