def testJoinSimpleRows(self): input_rows = [['x', 'y', 'z'], ['foo', 'bar']] expected = ['x\nfoo', 'y\nbar', 'z'] self.assertEquals(expected, join_rows(input_rows)) input_rows.append(['apple', '', 'pear']) expected = ['x foo apple', 'y bar', 'z pear'] self.assertEquals(expected, join_rows(input_rows, sep=' '))
def parse_table(raw_lines): row_partition = partition_raw_lines(raw_lines) lines = map(lambda row_string: join_rows(map(split_table_row, row_string)), row_partition) return unify_table(lines)