Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add type hints to test_requests.py #2481

Merged
merged 11 commits into from
Feb 6, 2024

Conversation

TechNiick
Copy link
Contributor

Summary

Related to this
Type annotation added to test_requests.py

Checklist

  • I understand that this PR may be closed in case there was no previous discussion. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.

Comment on lines 24 to 28
scope: typing.Dict[str, typing.Any],
receive: typing.Callable[[], typing.Awaitable[typing.Dict[str, typing.Any]]],
send: typing.Callable[
[typing.MutableMapping[str, typing.Any]], typing.Awaitable[None]
],
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you not using Scope, Receive, and Send?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated those in all places in this file.

Just a small note:
There are some places where I have added: test_client_factory: typing.Any. In those places I get an error when i try to use the TestClientFactory:
example: Argument "data" to "post" of "TestClient" has incompatible type "str"; expected "Optional[Mapping[str, Union[str, Iterable[str]]]]"

Comment on lines 12 to 17
from starlette.types import (
Message,
Receive,
Scope,
Send,
)
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix those.

Suggested change
from starlette.types import (
Message,
Receive,
Scope,
Send,
)
from starlette.types import Message, Receive, Scope, Send

@TechNiick TechNiick requested a review from Kludex February 4, 2024 19:02
@TechNiick TechNiick changed the title Added type annotations to test_requests.py Added type hints to test_requests.py Feb 4, 2024
tests/test_requests.py Outdated Show resolved Hide resolved
tests/test_requests.py Outdated Show resolved Hide resolved
tests/test_requests.py Outdated Show resolved Hide resolved
tests/test_requests.py Outdated Show resolved Hide resolved
tests/test_requests.py Outdated Show resolved Hide resolved
tests/test_requests.py Outdated Show resolved Hide resolved
tests/test_requests.py Outdated Show resolved Hide resolved
tests/test_requests.py Outdated Show resolved Hide resolved
@TechNiick TechNiick requested a review from Kludex February 6, 2024 20:14
@TechNiick TechNiick changed the title Added type hints to test_requests.py Add type hints to test_requests.py Feb 6, 2024
@Kludex Kludex merged commit 8c22296 into encode:master Feb 6, 2024
5 checks passed
nixroxursox pushed a commit to nixroxursox/starlette that referenced this pull request Mar 18, 2024
* added type annotations to test_requests.py

* requested changes

* indentations

* typos

* typos

* Apply suggestions from code review

* Apply suggestions from code review

---------

Co-authored-by: Scirlat Danut <scirlatdanut@scirlats-mini.lan>
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants