bpo-36144: Fixed test in test_collections.py#19221
Conversation
Test in TestChainMap() line 257 did not properly check union behavior.
|
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.
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