eliminate extra blank line in tabulate

Summary: Eliminate extra blank line in tabulate

Reviewed By: kmancini

Differential Revision: D22477405

fbshipit-source-id: b867bfa5c971fcac0104563e866a314416f24fb0
This commit is contained in:
Ailin Zhang 2020-07-17 06:42:24 -07:00 committed by Facebook GitHub Bot
parent 2deb2f28eb
commit aef527dbb0
2 changed files with 6 additions and 4 deletions

View File

@ -46,7 +46,9 @@ def tabulate(
format_string += "{:<%d}" % col_width
output = format_string.format(*[label(name) for name in headers])
output = output = output.rstrip(" ")
for row in rows:
output += "\n"
output += format_string.format(*[field(row, name) for name in headers])
output = output.rstrip(" ")
return output

View File

@ -24,9 +24,9 @@ class TabulateTest(unittest.TestCase):
self.assertEqual(
output,
f"""\
A B C {eol}
A B C{eol}
a_1 b_1 see_1{eol}
a_two b_2 c_2 {eol}""",
a_two b_2 c_2{eol}""",
)
def test_tabulate_header_labels(self):
@ -45,7 +45,7 @@ a_two b_2 c_2 {eol}""",
self.assertEqual(
output,
f"""\
Col1 bee C {eol}
Col1 bee C{eol}
a_1 b_1 see_1{eol}
a_two b_2 c_2 {eol}""",
a_two b_2 c_2{eol}""",
)