Skip to content
Myr

update typing tests for json

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Lord · committed by David Lord · parent f8cb0b0 · Browse files · 2 files+18 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+18 added−2 removed

  • tests:+11 added−1 removed
  • other:+7 added−1 removed

2 files+18 added−2 removed

modified:src/flask/typing.py+7 added-1 removed
5 unmodified lines
6 from werkzeug.wrappers import Response # noqa: F40178# The possible types that are directly convertible or are a Response object.9ResponseValue = t.Union[10 "Response", str, bytes, list, t.Dict[str, t.Any], t.Iterator[str], t.Iterator[bytes]10 "Response",11 str,12 bytes,13 t.List[t.Any],14 t.Dict[str, t.Any],15 t.Iterator[str],16 t.Iterator[bytes],17]1819# the possible types for an individual HTTP header20# This should be a Union, but mypy doesn't pass unless it's a TypeVar.
46 unmodified lines
modified:tests/typing/typing_route.py+11 added-1 removed
23 unmodified lines
242526@app.route("/json")27def hello_json() -> Response:28 return jsonify({"response": "Hello, World!"})28 return jsonify("Hello, World!")293031@app.route("/json/dict")32def hello_json_dict() -> t.Dict[str, t.Any]:33 return {"response": "Hello, World!"}343536@app.route("/json/dict")37def hello_json_list() -> t.List[t.Any]:38 return [{"message": "Hello"}, {"message": "World"}]394041@app.route("/generator")42def hello_generator() -> t.Generator[str, None, None]:43 def show() -> t.Generator[str, None, None]:44 for x in range(100):
54 unmodified lines