Skip to content

Commit

Permalink
Merge pull request #306 from oddbookworm/master
Browse files Browse the repository at this point in the history
Fix a `KeyError` when tabulating empty data with the `colalign` param populated
  • Loading branch information
astanin authored Sep 26, 2024
2 parents 7d8e8b3 + 0944a22 commit 520ed0e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/test_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,3 +512,14 @@ def test_numpy_int64_as_integer():
assert_equal(expected, result)
except ImportError:
raise skip("")

def test_empty_table_with_colalign():
"Regression: empty table with colalign kwarg"
table = tabulate([], ["a", "b", "c"], colalign=("center", "left", "left", "center"))
expected = "\n".join(
[
"a b c",
"--- --- ---",
]
)
assert_equal(expected, table)

0 comments on commit 520ed0e

Please sign in to comment.