Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 33.9k
Improve test coverage for is_typeddict#104884
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
In particular, it's important to test that is_typeddict(TypedDict) returns False.
Lib/test/test_typing.py Outdated
| assertis_typeddict(Point2D)isTrue | ||
| assertis_typeddict(Union[str, int])isFalse | ||
| self.assertTrue(is_typeddict(Point2D)) | ||
| self.assertFalse(is_typeddict(Union[str, int])) |
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.
+1 for using the unittest methods, but note that this isn't a direct translation. assertTrue only asserts that the thing is truthy, not that it actually is the True constant.
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.
Oh good point, I'll switch to assertIs(..., True).
| self.assertIs(is_typeddict(BarGeneric[int]), False) | ||
| self.assertIs(is_typeddict(BarGeneric()), False) | ||
| classNewGeneric[T](TypedDict): |
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.
I'll manually remove this one from the 3.11 backport
miss-islington commented May 24, 2023
Thanks @JelleZijlstra for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12. |
miss-islington commented May 24, 2023
Sorry @JelleZijlstra, I had trouble checking out the |
bedevere-bot commented May 24, 2023
GH-104888 is a backport of this pull request to the 3.11 branch. |
In particular, it's important to test that is_typeddict(TypedDict) returns False. (cherry picked from commit 1497607) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
miss-islington commented May 24, 2023
Thanks @JelleZijlstra for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12. |
bedevere-bot commented May 24, 2023
GH-104889 is a backport of this pull request to the 3.12 branch. |
In particular, it's important to test that is_typeddict(TypedDict) returns False. (cherry picked from commit 1497607) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
AlexWaygood commented May 24, 2023
We should probably backport these to |
JelleZijlstra commented May 24, 2023
Maybe we should get Miss Islington to do that too :) |
In particular, it's important to test that is_typeddict(TypedDict)
returns False.