diff --git a/tabulate/__init__.py b/tabulate/__init__.py index 12a2950..c13366d 100644 --- a/tabulate/__init__.py +++ b/tabulate/__init__.py @@ -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 = [ diff --git a/test/test_regression.py b/test/test_regression.py index 9555676..763f7a9 100644 --- a/test/test_regression.py +++ b/test/test_regression.py @@ -598,3 +598,14 @@ def test_github_escape_pipe_character(): result = tabulate([["foo|bar"]], headers=("spam|eggs",), tablefmt="github") expected = "| spam\\|eggs |\n|:------------|\n| foo\\|bar |" assert_equal(expected, result) + +def test_disable_numparse_with_maxcolwidths(): + "Regression: disable_numparse is honored when wrapping columns (issue #428)" + result = tabulate( + [["ports", "str", "comma-separated port list", "80,443"]], + ["name", "type", "desc", "default"], + tablefmt="grid", + disable_numparse=True, + maxcolwidths=40, + ) + assert "80,443" in result