Skip to content

Commit

Permalink
Merge pull request #957 from adamtheturtle/rm-unnecessary-isinstance
Browse files Browse the repository at this point in the history
  • Loading branch information
adamtheturtle committed May 10, 2024
2 parents 27f5b5a + 935e745 commit 6bfcd04
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
10 changes: 2 additions & 8 deletions src/requests_mock_flask/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,7 @@ def _responses_callback(

response = test_client.open(environ_builder.get_request())

result_headers: dict[str, str | int | bool | None] = dict(
response.headers,
)
return (response.status_code, result_headers, bytes(response.data))
return (response.status_code, dict(response.headers), bytes(response.data))


def _httpretty_callback(
Expand Down Expand Up @@ -218,10 +215,7 @@ def _httpretty_callback(
)
response = test_client.open(environ_builder.get_request())

result_headers: dict[str, str | int | bool | None] = dict(
response.headers,
)
return (response.status_code, result_headers, response.data)
return (response.status_code, dict(response.headers), response.data)


def _requests_mock_callback(
Expand Down
4 changes: 1 addition & 3 deletions tests/test_requests_mock_flask.py
Original file line number Diff line number Diff line change
Expand Up @@ -872,8 +872,7 @@ def test_request_needs_data(mock_ctx: _MockCtxType) -> None:
@app.route("/")
def _() -> str:
assert request.mimetype == "application/json"
request_json: dict[str, str] = request.get_json()
assert isinstance(request_json, dict)
request_json = request.get_json()
return str(request_json["hello"])

test_client = app.test_client()
Expand Down Expand Up @@ -1025,7 +1024,6 @@ def _() -> Response:
assert request.cookies["frasier"] == "crane"
assert request.cookies["frasier2"] == "crane2"
response.data = "Hello, World!"
assert isinstance(response, Response)
return response

test_client = app.test_client()
Expand Down

0 comments on commit 6bfcd04

Please sign in to comment.