def test_getRows_example_2(self): ############################## print 'Running unittests for this project: ', project_name print 'Running this unittest: ', self._testMethodName ############################## example_file = '%s%sexample_with_line_endings_in_quoted_col_titles.txt' % (dir_of_the_current_test,delimiter()) expected_col_titles = ['A','B','C','Unit','D','Unit','C \nplus D','Unit','E'] #It seems that csv.reader(...) converts "\r\n" inside quoted column title to "\n"![using Python 2.7.3] expected_data_row = ['M1_ID','M1','10','nanometers','20','nanometers','30','nanometers','Hello'] assert [expected_col_titles,expected_data_row] == getRows(example_file), "file=%s\nexpected rows=%s\nextracted rows=%s\n" % (example_file,str([expected_col_titles,expected_data_row]),str(getRows(example_file)))
def test_getRows_example_2(self): ############################## print 'Running unittests for this project: ', project_name print 'Running this unittest: ', self._testMethodName ############################## example_file = '%s%sexample_with_line_endings_in_quoted_col_titles.txt' % ( dir_of_the_current_test, delimiter()) expected_col_titles = [ 'A', 'B', 'C', 'Unit', 'D', 'Unit', 'C \nplus D', 'Unit', 'E' ] #It seems that csv.reader(...) converts "\r\n" inside quoted column title to "\n"![using Python 2.7.3] expected_data_row = [ 'M1_ID', 'M1', '10', 'nanometers', '20', 'nanometers', '30', 'nanometers', 'Hello' ] assert [expected_col_titles, expected_data_row] == getRows( example_file), "file=%s\nexpected rows=%s\nextracted rows=%s\n" % ( example_file, str([expected_col_titles, expected_data_row ]), str(getRows(example_file)))
def test_getRows_example_1(self): ############################## print 'Running unittests for this project: ', project_name print 'Running this unittest: ', self._testMethodName ############################## example_file = '%s%sexample_no_line_endings_in_col_titles.txt' % (dir_of_the_current_test,delimiter()) expected_col_titles = ['A','B','C','Unit','D','Unit','C plus D','Unit','E'] expected_data_row = ['M1_ID','M1','10','nanometers','20','nanometers','30','nanometers','Hello'] assert [expected_col_titles,expected_data_row] == getRows(example_file), "file=%s\nexpected rows=%s\nextracted rows=%s\n" % (example_file,str([expected_col_titles,expected_data_row]),str(getRows(example_file)))
def test_getRows_example_1(self): ############################## print 'Running unittests for this project: ', project_name print 'Running this unittest: ', self._testMethodName ############################## example_file = '%s%sexample_no_line_endings_in_col_titles.txt' % ( dir_of_the_current_test, delimiter()) expected_col_titles = [ 'A', 'B', 'C', 'Unit', 'D', 'Unit', 'C plus D', 'Unit', 'E' ] expected_data_row = [ 'M1_ID', 'M1', '10', 'nanometers', '20', 'nanometers', '30', 'nanometers', 'Hello' ] assert [expected_col_titles, expected_data_row] == getRows( example_file), "file=%s\nexpected rows=%s\nextracted rows=%s\n" % ( example_file, str([expected_col_titles, expected_data_row ]), str(getRows(example_file)))