I have a base class Parent that stores data for a test suite. All of its code is the same for different TestCases, except for one variable, raw_data_path. I want to parameterize this variable, but I don't know how to.
class Parent():
mapping_field_names = [
'motion_rv', 'motion_lv', 'wall_motion_other'
]
raw_data_path = make_path('input', 'raw_data.csv') # parameterize this variable
transform = Transform(df=load(raw_data_path))
transform.transform_df()
class TestMappings(unittest.TestCase, Parent):
def setUp(self) -> None:
self.df = self.transform.df_mappings # uses `make_path('input', 'raw_data.csv')`
return super().setUp()
class TestTransformData(unittest.TestCase, Parent):
def setUp(self) -> None:
self.df = self.transform.df # uses `make_path('input', 'raw_data.csv')`
return super().setUp()
class TestRawData(unittest.TestCase, Parent):
def setUp(self) -> None:
self.df = self.transform.df # except I want this with `make_path('test', 'raw_data.csv')`
return super().setUp()