Fix #7634. Support formatting signed numbers.

This commit is contained in:
Dion Moult
2026-02-06 16:35:04 +11:00
parent 5e9f97a0c7
commit 02fab6eee2
2 changed files with 2 additions and 1 deletions
@@ -144,7 +144,7 @@ format_grammar = lark.Lark(
| mul_div "*" function -> multiply
| mul_div "/" function -> divide
function: round | number | int | format_length | lower | upper | title | concat | substr | variable | ESCAPED_STRING | NUMBER | "(" expression ")"
function: round | number | int | format_length | lower | upper | title | concat | substr | variable | ESCAPED_STRING | SIGNED_NUMBER | "(" expression ")"
variable: "{{" query_path "}}"
query_path: /[^}]+/
@@ -54,6 +54,7 @@ class TestFormat:
def test_number_formatting(self):
assert subject.format("round(123, 5)") == "125"
assert subject.format('round("123", 5)') == "125"
assert subject.format('round(-123, 5)') == "-125"
assert subject.format("int(123.123)") == "123"
assert subject.format("int(123)") == "123"
assert subject.format("number(123)") == "123"