def test_read_file_from_csv(self): f = Filer() result = f.read_csv("test_renee.csv") expected = [[ 'EMPID', 'GENDER', 'AGE', 'SALES', 'BMI', 'SALARY', 'BIRTHDAY' ], ['A001', 'M', '26', '200', 'Normal', '20', '08-10-1991'], ['A002', 'F', '26', '300', 'Normal', '30', '09-10-1991']] self.assertEqual(expected, result, "didnt read file correctly")
def test_read_not_found_csv_exception(self): f = Filer() with self.assertRaises(FileNotFoundError) as context: f.read_csv('unfound.csv') self.assertTrue('No such file or directory')
def test_os_error_read_csv_exception(self): f = Filer() self.assertRaises(TypeError, f.read_csv('test2.db'))
def test_can_not_open_csv_general_exception(self): f = Filer() self.assertRaises(Exception, f.read_csv('test'))