MCPcopy
hub / github.com/pallets/flask / test_jsonify_arrays

Function test_jsonify_arrays

tests/test_json.py:105–130  ·  view source on GitHub ↗

Test jsonify of lists and args unpacking.

(app, client)

Source from the content-addressed store, hash-verified

103
104
105def test_jsonify_arrays(app, client):
106 """Test jsonify of lists and args unpacking."""
107 a_list = [
108 0,
109 42,
110 3.14,
111 "t",
112 "hello",
113 True,
114 False,
115 ["test list", 2, False],
116 {"test": "dict"},
117 ]
118
119 @app.route("/args_unpack")
120 def return_args_unpack():
121 return flask.jsonify(*a_list)
122
123 @app.route("/array")
124 def return_array():
125 return flask.jsonify(a_list)
126
127 for url in "/args_unpack", "/array":
128 rv = client.get(url)
129 assert rv.mimetype == "application/json"
130 assert flask.json.loads(rv.data) == a_list
131
132
133@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 2

getMethod · 0.45
loadsMethod · 0.45

Tested by

no test coverage detected