I have a class that contains XML strings. These are my models.
class ContainerForStringXMLs():
    def __init__(self):
        pass
    @staticmethod
    def get_model1(self):
        return """I'm a long string called model1"""
    @staticmethod
    def get_model2(self):
        return """I'm a long string called model2"""
I have a base test class which gives me access to the models in my other tests (and a few other things which aren't important here)
class BaseTest(unittest.TestCase):
    def setUp(self, model='model1'):
        self.model=model
        if self.model == 'model1':
            self.test_model = ContainerForStringXMLs.model1()
        elif self.model == 'model2':
            self.test_model = ContainerForStringXMLs.model2()
    def tearDown(self):
        del self.model
        del self.test_model
And my actual test class looks something like this:
class TestClass(BaseTest):
    def __init__(self):
        pass
    def test_on_model1(self):
        """
        I want to perform this test on model1
        """
        print self.test_model ##would return model 1
    def test_on_model2(self):
        """
        I want to perform this test on model 2 
        """
        print self.testmodel2
The test I want to perform is exactly the same test but the models are different and therefore the values that I pull from the xml will be different in each case. My question is: is there a nice pythonic way to switch between models from the TestClass? I was thinking perhaps a decorator or some sort?
It'd be great if I was able to use something like the following to choose which model I direct the test toward:
class TestClass(BaseTest):
    def __init__(self):
        pass
    @testmodel1
    def test_on_model1(self):
        """
        I want to perform this test on model1
        """
        print self.test_model ##would return model 1
    @testmodel2    
    def test_on_model2(self):
        """
        I want to perform this test on model 2 
        """
        print self.testmodel2
Is this sort of behavior possible?
 
    