Skip to content

Commit

Permalink
fix: add back removed case
Browse files Browse the repository at this point in the history
Signed-off-by: Frost Ming <me@frostming.com>
  • Loading branch information
frostming committed May 23, 2024
1 parent bccf4f1 commit 78884c4
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/test_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -969,3 +969,19 @@ def encode_decimal(obj):

assert api.dumps({"foo": decimal.Decimal("1.23")}) == "foo = 1.23\n"
api.unregister_encoder(encode_decimal)


def test_no_extra_minus_sign():
doc = parse("a = -1")
assert doc.as_string() == "a = -1"
doc["a"] *= -1
assert doc.as_string() == "a = +1"
doc["a"] *= -1
assert doc.as_string() == "a = -1"

doc = parse("a = -1.5")
assert doc.as_string() == "a = -1.5"
doc["a"] *= -1
assert doc.as_string() == "a = +1.5"
doc["a"] *= -1
assert doc.as_string() == "a = -1.5"

0 comments on commit 78884c4

Please sign in to comment.