Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Remove raw asserts in test_typing.py#104951

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

Merged
AlexWaygood merged 3 commits intopython:mainfromJelleZijlstra:rawassert
May 26, 2023

Conversation

JelleZijlstra
Copy link
Member

No description provided.

Comment on lines 7107 to 7108
self.assertEqual(Point2Dor3D.__required_keys__,frozenset(['x', 'y']))
self.assertEqual(Point2Dor3D.__optional_keys__,frozenset(['z']))
Copy link
Member

Choose a reason for hiding this comment

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

The changes in this PR look good. But it looks like we have a lot of tests in this test class that do things likeself.assertEqual(some_frozenset, frozenset(['x', 'y'])). Thatlooks like it's checking thatsome_frozenset is a frozenset, but it's actually not, because frozensets and sets with the same members compare equal. So I wonder if we should be doing this:

Suggested change
self.assertEqual(Point2Dor3D.__required_keys__,frozenset(['x','y']))
self.assertEqual(Point2Dor3D.__optional_keys__,frozenset(['z']))
self.assertEqual(Point2Dor3D.__required_keys__, {'x','y'})
self.assertIsInstance(Point2Dor3D.__required_keys__,frozenset)
self.assertEqual(Point2Dor3D.__optional_keys__, {'z'})
self.assertIsInstance(Point2Dor3D.__optional_keys__,frozenset)

But maybe we don't need to assert the type of__required_keys__ every time we want to check the contents of the set.

Copy link
Member

Choose a reason for hiding this comment

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

Anyway, we don't need to change that in this PR; the changes here are definitely good.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Might as well do that in this PR too.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Pushed a few new asserts checking that it's really a frozenset

AlexWaygood reacted with hooray emoji
Copy link
Member

@AlexWaygoodAlexWaygood left a comment

Choose a reason for hiding this comment

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

LGTM

@AlexWaygoodAlexWaygood merged commit2cb4456 intopython:mainMay 26, 2023
@miss-islington
Copy link
Contributor

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

miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestMay 26, 2023
(cherry picked from commit2cb4456)Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
@bedevere-bot
Copy link

GH-104978 is a backport of this pull request to the3.12 branch.

@bedevere-botbedevere-bot removed the needs backport to 3.12only security fixes labelMay 26, 2023
@bedevere-bot
Copy link

GH-104979 is a backport of this pull request to the3.11 branch.

@bedevere-botbedevere-bot removed the needs backport to 3.11only security fixes labelMay 26, 2023
miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestMay 26, 2023
(cherry picked from commit2cb4456)Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
AlexWaygood pushed a commit that referenced this pull requestMay 26, 2023
Remove raw asserts in test_typing.py (GH-104951)(cherry picked from commit2cb4456)Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
AlexWaygood pushed a commit that referenced this pull requestMay 26, 2023
Remove raw asserts in test_typing.py (GH-104951)(cherry picked from commit2cb4456)Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@Fidget-SpinnerFidget-SpinnerFidget-Spinner approved these changes

@AlexWaygoodAlexWaygoodAlexWaygood approved these changes

@gvanrossumgvanrossumAwaiting requested review from gvanrossum

Assignees
No one assigned
Labels
skip issueskip newstestsTests in the Lib/test dir
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

5 participants
@JelleZijlstra@miss-islington@bedevere-bot@Fidget-Spinner@AlexWaygood

[8]ページ先頭

©2009-2025 Movatter.jp