summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2010-07-11 19:17:28 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2010-07-11 19:17:28 (GMT)
commit42add99f77fbb4eb1af65213e1b4936397afe490 (patch)
tree8191d69640b9461913015628bf7d00cd7bb284f5 /Lib/test
parent3266978300ace81216e7cf7d072d43319efa2f65 (diff)
downloadcpython-42add99f77fbb4eb1af65213e1b4936397afe490.zip
cpython-42add99f77fbb4eb1af65213e1b4936397afe490.tar.gz
cpython-42add99f77fbb4eb1af65213e1b4936397afe490.tar.bz2
Merged revisions 82821 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r82821 | mark.dickinson | 2010-07-11 19:53:06 +0100 (Sun, 11 Jul 2010) | 3 lines Issue #9137: Fix issue in MutableMapping.update, which incorrectly treated keyword arguments called 'self' or 'other' specially. ........
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_collections.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py
index 363511f..a0f0fbc 100644
--- a/Lib/test/test_collections.py
+++ b/Lib/test/test_collections.py
@@ -766,6 +766,19 @@ class TestOrderedDict(unittest.TestCase):
od.update([('a', 1), ('b', 2), ('c', 9), ('d', 4)], c=3, e=5)
self.assertEqual(list(od.items()), pairs) # mixed input
+ # Issue 9137: Named argument called 'other' or 'self'
+ # shouldn't be treated specially.
+ od = OrderedDict()
+ od.update(self=23)
+ self.assertEqual(list(od.items()), [('self', 23)])
+ od = OrderedDict()
+ od.update(other={})
+ self.assertEqual(list(od.items()), [('other', {})])
+ od = OrderedDict()
+ od.update(red=5, blue=6, other=7, self=8)
+ self.assertEqual(sorted(list(od.items())),
+ [('blue', 6), ('other', 7), ('red', 5), ('self', 8)])
+
# Make sure that direct calls to update do not clear previous contents
# add that updates items are not moved to the end
d = OrderedDict([('a', 1), ('b', 2), ('c', 3), ('d', 44), ('e', 55)])