def test_return_data_as_objects(self): people = self.csv_reader.return_data_as_class('person') self.assertIsInstance(people, list) test_class = ClassFactory('person', self.csv_reader.data[0]) for person in people: self.assertEqual(person.__name__, test_class.__name__) pprint(vars(person))
def test_return_data_as_objects(self): rows = self.csv_reader.return_data_as_objects('row') self.assertIsInstance(rows, list) test_class = ClassFactory('row', self.csv_reader.data[0]) for row in rows: self.assertEqual(row.__name__, test_class.__name__)
def test_return_data_as_objects_values(self): test_data_values = self.csv_reader.return_data_as_objects('Values') self.assertIsInstance(test_data_values, list) test_class = ClassFactory('Values', self.csv_reader.data[0]) for test_data in test_data_values: self.assertEqual(test_data.__name__, test_class.__name__)
def return_data_as_objects(self, class_name): objects = list() for row in self.data: objects.append(ClassFactory(class_name, row)) return objects