Visitar URL original
gh-136203: Improve `TypeError` msg when comparing two `MappingProxyType`s by sobolevn · Pull Request #136204 · python/cpython · GitHub
The Wayback Machine - https://web.archive.org/web/20250702124622/https://github.com/python/cpython/pull/136204
Skip to content

gh-136203: Improve TypeError msg when comparing two MappingProxyTypes #136204

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sobolevn
Copy link
Member

@sobolevn sobolevn commented Jul 2, 2025 •

@@ -1376,6 +1376,27 @@ def __hash__(self):
view = self.mappingproxy(mapping)
self.assertEqual(hash(view), hash(mapping))

def test_richcompare(self):
mp1 = self.mappingproxy({'a': 1})
mp1_2 = self.mappingproxy({'a': 1})
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe use mp1_other or mp1_copy?

with self.assertRaisesRegex(TypeError, msg):
mp2 >= mp2
with self.assertRaisesRegex(TypeError, msg):
mp1_2 <= mp1
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not use mp1 and mp2 in each comparison?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants