-
-
Notifications
You must be signed in to change notification settings - Fork 960
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_authentication.py
#2472
Add type hints to test_authentication.py
#2472
Conversation
test_authentication.py
test_authentication.py
test_authentication.py
@@ -1,9 +1,16 @@ | |||
import base64 | |||
import binascii | |||
import sys | |||
from typing import Any, Awaitable, Callable, Optional, Tuple |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's avoid use Any
, please.
tests/test_authentication.py
Outdated
from starlette.testclient import TestClient | ||
from starlette.websockets import WebSocket, WebSocketDisconnect | ||
|
||
P = ParamSpec("P") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it being used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I have added it on **kwargs: P.kwargs
.
…ick/starlette into improve-types/test_authentication
tests/test_authentication.py
Outdated
def ws_inject_decorator(**kwargs): | ||
def wrapper(endpoint): | ||
def app(websocket): | ||
def ws_inject_decorator(**kwargs: P.kwargs) -> Callable[..., AsyncEndpoint]: # type: ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def ws_inject_decorator(**kwargs: P.kwargs) -> Callable[..., AsyncEndpoint]: # type: ignore | |
def ws_inject_decorator(**kwargs: Any) -> Callable[..., AsyncEndpoint]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P is wrong.
* added type annotations to test_authentication.py * fixed types * Apply suggestions from code review * Fix linting * Fix linting * Apply suggestions from code review --------- Co-authored-by: Scirlat Danut <[email protected]> Co-authored-by: Marcelo Trylesinski <[email protected]>
Summary
Related to this
Type annotation added to
test_authentication.py
Checklist