jsonify encodes decimal to str

This commit is contained in:
default-303 2021-06-19 17:27:56 +05:30 committed by David Lord
parent 06cf349bb8
commit 892ae95509
No known key found for this signature in database
GPG key ID: 7A1C87E3F5BC42A8
3 changed files with 16 additions and 1 deletions

View file

@ -1,4 +1,5 @@
import datetime
import decimal
import io
import uuid
@ -187,6 +188,11 @@ def test_jsonify_uuid_types(app, client):
assert rv_uuid == test_uuid
def test_json_decimal():
rv = flask.json.dumps(decimal.Decimal("0.003"))
assert rv == '"0.003"'
def test_json_attr(app, client):
@app.route("/add", methods=["POST"])
def add():