Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.2k
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 ourterms of service andprivacy 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) is True | ||
assertis_typeddict(Union[str, int]) is False | ||
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 adirect translation.assertTrue
only asserts that the thing is truthy, not that it actually is theTrue
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 toassertIs(..., True)
.
self.assertIs(is_typeddict(BarGeneric[int]), False) | ||
self.assertIs(is_typeddict(BarGeneric()), False) | ||
class NewGeneric[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
Thanks@JelleZijlstra for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12. |
Sorry@JelleZijlstra, I had trouble checking out the |
bedevere-bot commentedMay 24, 2023
GH-104888 is a backport of this pull request to the3.11 branch. |
In particular, it's important to test that is_typeddict(TypedDict)returns False.(cherry picked from commit1497607)Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Thanks@JelleZijlstra for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12. |
bedevere-bot commentedMay 24, 2023
GH-104889 is a backport of this pull request to the3.12 branch. |
In particular, it's important to test that is_typeddict(TypedDict)returns False.(cherry picked from commit1497607)Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
We should probably backport these to |
Maybe we should get Miss Islington to do that too :) |
In particular, it's important to test that is_typeddict(TypedDict)
returns False.