8000 Fix bug in test_collections.py (#19221) · python/cpython@0c5ad54 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0c5ad54

Browse files
authored
Fix bug in test_collections.py (#19221)
Test in TestChainMap() line 257 did not properly check union behavior.
1 parent 676b105 commit 0c5ad54

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Lib/test/test_collections.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,9 @@ def test_union_operators(self):
253253
# testing behavior between chainmap and iterable key-value pairs
254254
with self.assertRaises(TypeError):
255255
cm3 | pairs
256+
tmp = cm3.copy()
256257
cm3 |= pairs
257-
self.assertEqual(cm3.maps, [cm3.maps[0] | dict(pairs), *cm3.maps[1:]])
258+
self.assertEqual(cm3.maps, [tmp.maps[0] | dict(pairs), *tmp.maps[1:]])
258259

259260
# testing proper return types for ChainMap and it's subclasses
260261
class Subclass(ChainMap):

0 commit comments

Comments
 (0)
0