def output_package_listing_columns(self, data, header): # insert the header first: we need to know the size of column names if len(data) > 0: data.insert(0, header) pkg_strings, sizes = tabulate(data) # Create and add a separator. if len(data) > 0: pkg_strings.insert(1, " ".join(map(lambda x: '-' * x, sizes))) for val in pkg_strings: write_output(val)
def test_tabulate(rows, table, sizes): assert tabulate(rows) == (table, sizes)
def test_tabulate(rows: List[Tuple[str]], table: List[str], sizes: List[int]) -> None: assert tabulate(rows) == (table, sizes)