summaryrefslogtreecommitdiff
path: root/lab
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2022-06-14 19:59:19 -0400
committerNed Batchelder <ned@nedbatchelder.com>2022-06-14 19:59:19 -0400
commit2fb47c6b2d936118657f6b217dbd152ba70cf98c (patch)
tree2b5d7858af27db8bd6b6308c1b77e4ab243998f1 /lab
parent7cd57dc22d7a101f0d14972b300dcdf1d9b2fd73 (diff)
downloadpython-coveragepy-git-2fb47c6b2d936118657f6b217dbd152ba70cf98c.tar.gz
test(benchmark): properly aligned table columns
Diffstat (limited to 'lab')
-rw-r--r--lab/benchmark.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/lab/benchmark.py b/lab/benchmark.py
index e0da7638..a4583be2 100644
--- a/lab/benchmark.py
+++ b/lab/benchmark.py
@@ -412,8 +412,9 @@ class Experiment:
data_order = [*rows, column]
remap = [data_order.index(datum) for datum in ["proj", "pyver", "cov"]]
+ WIDTH = 20
def as_table_row(vals):
- return "| " + " | ".join(vals) + " |"
+ return "| " + " | ".join(v.ljust(WIDTH) for v in vals) + " |"
header = []
header.extend(rows)
@@ -422,7 +423,8 @@ class Experiment:
print()
print(as_table_row(header))
- print("|----" * len(header) + "|")
+ dashes = [":---"] * len(rows) + ["---:"] * (len(header) - len(rows))
+ print(as_table_row(dashes))
for tup in itertools.product(*table_axes):
row = []
row.extend(tup)