]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix bug in test_collections.py (#19221)
authorCurtis Bucher <cpbucher5@gmail.com>
Mon, 30 Mar 2020 16:50:57 +0000 (09:50 -0700)
committerGitHub <noreply@github.com>
Mon, 30 Mar 2020 16:50:57 +0000 (09:50 -0700)
Test in TestChainMap() line 257 did not properly check union behavior.

Lib/test/test_collections.py

index 47c500bcdd002505f527fdfcc363a1f752eee4f3..0207823f5aab7262e625ce45799b2dcd3529014a 100644 (file)
@@ -253,8 +253,9 @@ class TestChainMap(unittest.TestCase):
         # testing behavior between chainmap and iterable key-value pairs
         with self.assertRaises(TypeError):
             cm3 | pairs
+        tmp = cm3.copy()
         cm3 |= pairs
-        self.assertEqual(cm3.maps, [cm3.maps[0] | dict(pairs), *cm3.maps[1:]])
+        self.assertEqual(cm3.maps, [tmp.maps[0] | dict(pairs), *tmp.maps[1:]])
 
         # testing proper return types for ChainMap and it's subclasses
         class Subclass(ChainMap):