class CsvReaderTestCase(unittest.TestCase): def setUp(self): self.correct_filename = get_data_path('ISC_small_data.csv', DATA_DIR) self.csv_reader = CsvReader(self.correct_filename) self.first_data_row = [ '1', 'AAA', '20000102034913', '2000', '01', '02', '03', '49', '13', '0.02', '7.282', '44.368', '2.43', '1.01', '298', '9.3', '0.5', '1.71', '0.355', ' ', ' ', ' ', ' ', '1.7', '0.1'] def test_an_incorrect_csv_filename_raise_exception(self): self.assertRaises(IOError, CsvReader, FILE_NAME_ERROR) def test_get_csv_fieldnames(self): self.assertEqual(FIELDNAMES, self.csv_reader.fieldnames) def test_number_read_lines(self): expected_num_lines = 10 read_num_lines = 0 for _ in self.csv_reader.read(): read_num_lines += 1 self.assertEqual(expected_num_lines, read_num_lines) def test_read_line(self): self.assertEqual(self.first_data_row, self.csv_reader.read().next())
class CsvReaderTestCase(unittest.TestCase): def setUp(self): self.correct_filename = get_data_path('ISC_small_data.csv', DATA_DIR) self.csv_reader = CsvReader(self.correct_filename) self.first_data_row = [ '1', 'AAA', '20000102034913', '2000', '01', '02', '03', '49', '13', '0.02', '7.282', '44.368', '2.43', '1.01', '298', '9.3', '0.5', '1.71', '0.355', ' ', ' ', ' ', ' ', '1.7', '0.1' ] def test_an_incorrect_csv_filename_raise_exception(self): self.assertRaises(IOError, CsvReader, FILE_NAME_ERROR) def test_get_csv_fieldnames(self): self.assertEqual(FIELDNAMES, self.csv_reader.fieldnames) def test_number_read_lines(self): expected_num_lines = 10 read_num_lines = 0 for _ in self.csv_reader.read(): read_num_lines += 1 self.assertEqual(expected_num_lines, read_num_lines) def test_read_line(self): self.assertEqual(self.first_data_row, self.csv_reader.read().next())
def setUp(self): self.correct_filename = get_data_path('ISC_small_data.csv', DATA_DIR) self.csv_reader = CsvReader(self.correct_filename) self.first_data_row = [ '1', 'AAA', '20000102034913', '2000', '01', '02', '03', '49', '13', '0.02', '7.282', '44.368', '2.43', '1.01', '298', '9.3', '0.5', '1.71', '0.355', ' ', ' ', ' ', ' ', '1.7', '0.1' ]
def setUp(self): self.correct_filename = get_data_path('ISC_small_data.csv', DATA_DIR) self.csv_reader = CsvReader(self.correct_filename) self.first_data_row = [ '1', 'AAA', '20000102034913', '2000', '01', '02', '03', '49', '13', '0.02', '7.282', '44.368', '2.43', '1.01', '298', '9.3', '0.5', '1.71', '0.355', ' ', ' ', ' ', ' ', '1.7', '0.1']