def test_update(self):
for kw in 'self', 'other', 'iterable':
d = UserDict.UserDict()
d.update(**{kw: 42})
self.assertEqual(list(d.items()), [(kw, 42)])
d = UserDict.UserDict()
with test_support.check_warnings((".*'dict'.*",
PendingDeprecationWarning)):
d.update(dict={'a': 42})
self.assertEqual(list(d.items()), [('a', 42)])
self.assertRaises(TypeError, UserDict.UserDict().update, 42)
self.assertRaises(TypeError, UserDict.UserDict().update, {}, {})
self.assertRaises(TypeError, UserDict.UserDict.update)
评论列表
文章目录