summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_userdict.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2004-03-04 08:25:44 (GMT)
committerRaymond Hettinger <python@rcn.com>2004-03-04 08:25:44 (GMT)
commit31017aed36a5c5b0e4b16ca58bea09c9ce360134 (patch)
tree766d70bb4fbb6878a71c81fc3874515cfcbc8aa8 /Lib/test/test_userdict.py
parent6c79a518e70ea8e45e3287573d99c648ae3cb21b (diff)
downloadcpython-31017aed36a5c5b0e4b16ca58bea09c9ce360134.zip
cpython-31017aed36a5c5b0e4b16ca58bea09c9ce360134.tar.gz
cpython-31017aed36a5c5b0e4b16ca58bea09c9ce360134.tar.bz2
SF #904720: dict.update should take a 2-tuple sequence like dict.__init_
(Championed by Bob Ippolito.) The update() method for mappings now accepts all the same argument forms as the dict() constructor. This includes item lists and/or keyword arguments.
Diffstat (limited to 'Lib/test/test_userdict.py')
-rw-r--r--Lib/test/test_userdict.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/test/test_userdict.py b/Lib/test/test_userdict.py
index 602fd90..0ed4369 100644
--- a/Lib/test/test_userdict.py
+++ b/Lib/test/test_userdict.py
@@ -93,8 +93,12 @@ class TestMappingProtocol(unittest.TestCase):
#update
p.update(self.reference)
self.assertEqual(dict(p), self.reference)
+ items = p.items()
+ p = self._empty_mapping()
+ p.update(items)
+ self.assertEqual(dict(p), self.reference)
d = self._full_mapping(self.reference)
- #setdefaullt
+ #setdefault
key, value = d.iteritems().next()
knownkey, knownvalue = self.other.iteritems().next()
self.assertEqual(d.setdefault(key, knownvalue), value)