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
10 changes: 10 additions & 0 deletions test/test_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,16 @@ def test_exception_on_empty_data_with_maxcolwidths():
assert_equal(result, "")


def test_disable_numparse_honored_with_maxcolwidths():
"Regression: disable_numparse honored on the wrap path (github issue #428)"
# A number-ish but unparseable cell ('80,443') must not be parsed when
# disable_numparse=True, even when maxcolwidths triggers the wrap path.
table = [["ports", "str", "comma-separated port list", "80,443"]]
headers = ["name", "type", "desc", "default"]
result = tabulate(table, headers, tablefmt="grid", disable_numparse=True, maxcolwidths=40)
assert "80,443" in result


def test_numpy_int64_as_integer():
"Regression: format numpy.int64 as integer (github issue #18)"
try:
Expand Down