FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Improve test coverage for is_typeddict by JelleZijlstra · Pull Request #104884 · python/cpython · GitHub

/ cpython Public

Improve test coverage for is_typeddict - #104884

Merged
JelleZijlstra merged 2 commits into
python:mainfrom
JelleZijlstra:istdtests
May 24, 2023
Merged

Improve test coverage for is_typeddict#104884
JelleZijlstra merged 2 commits into
python:mainfrom
JelleZijlstra:istdtests

Conversation

Copy link
Copy Markdown
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-bot added awaiting core review tests Tests in the Lib/test dir labels May 24, 2023
JelleZijlstra changed the title Improve test coverage for TypedDict Improve test coverage for is_typeddict May 24, 2023
Comment thread Lib/test/test_typing.py Outdated
Comment on lines +7226 to +7227
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]))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

+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
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Oh good point, I'll switch to assertIs(..., True).

Comment thread Lib/test/test_typing.py
self.assertIs(is_typeddict(BarGeneric[int]), False)
self.assertIs(is_typeddict(BarGeneric()), False)

class NewGeneric[T](TypedDict):

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I'll manually remove this one from the 3.11 backport

JelleZijlstra merged commit 1497607 into python:main May 24, 2023

Copy link
Copy Markdown
Contributor

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

JelleZijlstra deleted the istdtests branch May 24, 2023 18:46

Copy link
Copy Markdown
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

Copy link
Copy Markdown

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-bot removed the needs backport to 3.11 only security fixes label May 24, 2023
JelleZijlstra added needs backport to 3.12 only security fixes and removed needs backport to 3.12 only security fixes labels May 24, 2023

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown

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-bot removed the needs backport to 3.12 only security fixes label May 24, 2023

Copy link
Copy Markdown
Member

We should probably backport these to typing_extensions too

Copy link
Copy Markdown
Member Author

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>
JelleZijlstra restored the istdtests branch September 10, 2024 23:37
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL