-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[ty] Add more tests for NamedTuples
#17975
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
Conversation
|
This comment was marked as outdated.
This comment was marked as outdated.
sharkdp
left a comment
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.
Thank you!
| ### Definition | ||
|
|
||
| ```py | ||
| from typing import NamedTuple | ||
|
|
||
| class Location(NamedTuple): | ||
| altitude: float = 0.0 | ||
| latitude: float # TODO: this should be an error. Fields without default values cannot come after fields with. | ||
| longitude: float | ||
| ``` |
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.
Can we move this test somewhere below? I'd like to have the "Basics" test on top.
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.
Sure, done!
|
Thanks David. I've addressed both your comments. |
Summary
Add more tests and TODOs for
NamedTuplesupport, based on the typing spec: https://typing.python.org/en/latest/spec/namedtuples.htmlTest Plan
This PR adds new tests.