Skip to content

Commit 9750581

Browse files
committed
[benchmark] ReportFormatter: right-align num cols
1 parent af7ef03 commit 9750581

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

benchmark/scripts/compare_perf_tests.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,9 @@ def row(contents):
631631
def header(title, column_labels):
632632
h = ''
633633
if not self.header_printed:
634-
h = '\n' + row(column_labels) + row([HEADER_SEPARATOR] * 5)
634+
h = '\n' + row(column_labels)
635+
h += row([':' + HEADER_SEPARATOR] + # left align 1st column
636+
([HEADER_SEPARATOR + ':']) * 4) # right align rest
635637
if self.single_table:
636638
h += row(('**' + title + '**', '', '', '', ''))
637639
if self.single_table and not self.header_printed:

benchmark/scripts/test_compare_perf_tests.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ def test_column_headers(self):
759759
)
760760
self.assert_markdown_contains([
761761
'TEST | OLD | NEW | DELTA | RATIO',
762-
'--- | --- | --- | --- | --- ',
762+
':--- | ---: | ---: | ---: | ---: ',
763763
'TEST | MIN | MAX | MEAN | MAX_RSS'])
764764
self.assert_git_contains([
765765
'TEST OLD NEW DELTA RATIO',
@@ -864,8 +864,8 @@ def test_single_table_report(self):
864864
'**Regression**', '**Added**',
865865
'| OLD', '| NEW', '| DELTA', '| RATIO'
866866
], markdown)
867-
self.assertIn('\n--- ', markdown) # first column
868-
self.assertEqual(markdown.count('| ---'), 4)
867+
self.assertIn('\n:---', markdown) # first column is left aligned
868+
self.assertEqual(markdown.count('| ---:'), 4) # other, right aligned
869869

870870

871871
class Test_parse_args(unittest.TestCase):

0 commit comments

Comments
 (0)