Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tabulate/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1652,7 +1652,7 @@ def _wrap_text_to_colwidths(
else (
str(cell)
if cell == "" or _isnumber(cell)
else str(_type(cell, numparse)(cell))
else str(_type(cell, numparse=numparse)(cell))
)
)
wrapped = [
Expand Down
12 changes: 12 additions & 0 deletions test/test_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -3292,6 +3292,18 @@ def test_disable_numparse_true():
assert_equal(expected, result)


def test_disable_numparse_maxcolwidths_keeps_thousands_separator():
"Wrapping must not parse a disabled numeric column such as 100,120"
result = tabulate(
[["100,120"]],
headers=["x"],
tablefmt="plain",
maxcolwidths=[20],
disable_numparse=True,
)
assert "100,120" in result


def test_disable_numparse_list():
"Output: Default table output, but with number parsing selectively disabled"
table_headers = ["h1", "h2", "h3"]
Expand Down