-
-
Notifications
You must be signed in to change notification settings - Fork 31.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
Conversation
In particular, it's important to test that is_typeddict(TypedDict) returns False.
Lib/test/test_typing.py
Outdated
assert is_typeddict(Point2D) is True | ||
assert is_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 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) | ||
|
||
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 |
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 <[email protected]>
Thanks @JelleZijlstra for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12. |
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 <[email protected]>
We should probably backport these to |
Maybe we should get Miss Islington to do that too :) |
Improve test coverage for is_typeddict (GH-104884) In particular, it's important to test that is_typeddict(TypedDict) returns False. (cherry picked from commit 1497607) Co-authored-by: Jelle Zijlstra <[email protected]>
In particular, it's important to test that is_typeddict(TypedDict) returns False. (cherry picked from commit 1497607) Co-authored-by: Jelle Zijlstra <[email protected]>
In particular, it's important to test that is_typeddict(TypedDict)
returns False.