Skip to content

Conversation

@JelleZijlstra
Copy link
Member

In particular, it's important to test that is_typeddict(TypedDict)
returns False.

In particular, it's important to test that is_typeddict(TypedDict) returns False.
@bedevere-botbedevere-bot added awaiting core review tests Tests in the Lib/test dir labels May 24, 2023
@JelleZijlstraJelleZijlstra changed the title Improve test coverage for TypedDictImprove test coverage for is_typeddictMay 24, 2023
Comment on lines 7226 to 7227
assertis_typeddict(Point2D)isTrue
assertis_typeddict(Union[str, int])isFalse
self.assertTrue(is_typeddict(Point2D))
self.assertFalse(is_typeddict(Union[str, int]))
Copy link
Member

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.

Copy link
MemberAuthor

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):
Copy link
MemberAuthor

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

@JelleZijlstraJelleZijlstra merged commit 1497607 into python:mainMay 24, 2023
@miss-islington
Copy link
Contributor

Thanks @JelleZijlstra for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12.
🐍🍒⛏🤖

@JelleZijlstraJelleZijlstra deleted the istdtests branch May 24, 2023 18:46
@miss-islington
Copy link
Contributor

Sorry @JelleZijlstra, I had trouble checking out the 3.12 backport branch.
Please retry by removing and re-adding the "needs backport to 3.12" label.
Alternatively, you can backport using cherry_picker on the command line.
cherry_picker 1497607a8e99f1103c40368dd5f9057f0146a520 3.12

@bedevere-bot
Copy link

GH-104888 is a backport of this pull request to the 3.11 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 24, 2023
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>
@bedevere-botbedevere-bot removed the needs backport to 3.11 only security fixes label May 24, 2023
@JelleZijlstraJelleZijlstra added needs backport to 3.12 only security fixes and removed needs backport to 3.12 only security fixes labels May 24, 2023
@miss-islington
Copy link
Contributor

Thanks @JelleZijlstra for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-104889 is a backport of this pull request to the 3.12 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 24, 2023
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>
@bedevere-botbedevere-bot removed the needs backport to 3.12 only security fixes label May 24, 2023
@AlexWaygood
Copy link
Member

We should probably backport these to typing_extensions too

@JelleZijlstra
Copy link
MemberAuthor

Maybe we should get Miss Islington to do that too :)

AlexWaygood pushed a commit that referenced this pull request May 24, 2023
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 <jelle.zijlstra@gmail.com>
JelleZijlstra added a commit that referenced this pull request May 24, 2023
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>
@JelleZijlstraJelleZijlstra restored the istdtests branch September 10, 2024 23:37
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip issueskip newstestsTests in the Lib/test dirtopic-typing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@JelleZijlstra@miss-islington@bedevere-bot@AlexWaygood