From d3abd949c1cd0c5b83de981a0e86c5f62835d321 Mon Sep 17 00:00:00 2001 From: Shamik Basu Date: Sun, 11 Oct 2026 17:52:48 -0700 Subject: [PATCH] Pass numparse by keyword when wrapping table cells. The flag was bound to has_invisible, so disable_numparse was ignored for values like 100,120. Co-authored-by: Cursor --- tabulate/__init__.py | 2 +- test/test_output.py | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) 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_output.py b/test/test_output.py index ea3da87..41d99b8 100644 --- a/test/test_output.py +++ b/test/test_output.py @@ -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"]