I have a number of different custom transformer functions, and want to run a simple test (e.g. printing out the transformer) on all of these functions. I could write individual tests for each function, but thought there must be an easier way.
I've looked at parameterizing the test but get: TypeError: 'function' object is not iterable
@pytest.fixture
def list_transformers(self):
list_transformers = [
TransformerOne(column='a'),
TransformerTwo(column='a')
]
return list_trasformers
@pytest.mark.parametrize("transformer", list_transformers)
def test_print(self, transformer):
tf_type = transformer[0]
params = transformer[1]
tf = tf_type(**params)
print(tf)
I think this is because the transformer functions are not returning something iterable. Should I be going about this in a different way?