def testUnifyTablesRemovesEmptyColumns(self): input = [['x', '', 'y'], ['xxx', '', 'yyyy', 'zz', ' ']] expected = [['x', 'y', ''], ['xxx', 'yyyy', 'zz']] self.assertEquals(expected, unify_table(input))
def testUnifyTables(self): input = [[' x ', ' y'], ['xxx', ' yyyy ', 'zz']] expected = [[' x ', ' y', ''], ['xxx', ' yyyy ', 'zz']] self.assertEqual(expected, unify_table(input))
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)