-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
bpo-36144: Fixed test in test_collections.py #19221
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
Test in TestChainMap() line 257 did not properly check union behavior.
brandtbucher
left a comment
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.
Nice catch!
|
Ubuntu failure looks unrelated. |
Yeah it's definitely unrelated, since it failed in the "Install Dependencies" stage. I'll close and re-open the PR to restart the CI checks. (For some reason, GitHub Actions retains the old failing checks on the same commit, but should still prove that the failure was unrelated to the PR). |
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.
Thanks for the PR @curtisbucher.
We should be using .copy() to compare key, value pairs and ChainMap in line 257. Otherwise it does not properly check union behavior.
Agreed; if it's the same object, the test doesn't work as intended. After cm3 |= pairs, even the following would pass:
self.assertEqual(cm3.maps, [cm3.maps[0] | dict(), *cm3.maps[1:]])
(which somewhat defeats the purpose of the test)
|
@gvanrossum: Please replace |
We should be using
.copy()to compare key, value pairs and ChainMap in line 257. Otherwise it does not properly check union behavior.@brandtbucher
https://bugs.python.org/issue36144