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_responses.py #2488

Merged
merged 8 commits into from Feb 9, 2024

Conversation

TechNiick
Copy link
Contributor

Summary

Related to this
Type annotation added to test_responses.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.

tests/test_responses.py Outdated Show resolved Hide resolved
@Kludex Kludex enabled auto-merge (squash) February 7, 2024 18:40
auto-merge was automatically disabled February 7, 2024 19:24

Head branch was pushed to by a user without write access

async def app(scope, receive, send):
async def numbers(minimum, maximum):
async def app(scope: Scope, receive: Receive, send: Send) -> None:
async def numbers(minimum: int, maximum: int) -> AsyncGenerator[str, 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.

Suggested change
async def numbers(minimum: int, maximum: int) -> AsyncGenerator[str, None]:
async def numbers(minimum: int, maximum: int) -> AsyncIterator[str]:

nonlocal streamed
if message["type"] == "http.response.body":
streamed += len(message.get("body", b""))
# Simulate disconnection after download has started
if streamed >= 16:
disconnected.set()

async def stream_indefinitely():
async def stream_indefinitely() -> AsyncGenerator[bytes, 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.

Suggested change
async def stream_indefinitely() -> AsyncGenerator[bytes, None]:
async def stream_indefinitely() -> AsyncIterator[bytes]:

tests/test_responses.py Outdated Show resolved Hide resolved
tests/test_responses.py Outdated Show resolved Hide resolved
@Kludex Kludex enabled auto-merge (squash) February 9, 2024 09:28
@Kludex Kludex merged commit ac7e643 into encode:master Feb 9, 2024
5 checks passed
nixroxursox pushed a commit to nixroxursox/starlette that referenced this pull request Mar 18, 2024
* Add type hints to test_responses.py

* Update tests/test_responses.py

* Linter fix

* 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