diff options
author | Raymond Hettinger <python@rcn.com> | 2003-03-06 23:54:28 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2003-03-06 23:54:28 (GMT) |
commit | a3e1e4cd79abe7069c8bc20db65161dd8c68b305 (patch) | |
tree | 18ff4fb0f06cc1a684da8ad62ce21a5b14c1a33c /Lib/test/test_userdict.py | |
parent | 2b4821347f00b01746562d58390a213924f2b102 (diff) | |
download | cpython-a3e1e4cd79abe7069c8bc20db65161dd8c68b305.zip cpython-a3e1e4cd79abe7069c8bc20db65161dd8c68b305.tar.gz cpython-a3e1e4cd79abe7069c8bc20db65161dd8c68b305.tar.bz2 |
SF patch #693753: fix for bug 639806: default for dict.pop
(contributed by Michael Stone.)
Diffstat (limited to 'Lib/test/test_userdict.py')
-rw-r--r-- | Lib/test/test_userdict.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_userdict.py b/Lib/test/test_userdict.py index d3e8002..cb98308 100644 --- a/Lib/test/test_userdict.py +++ b/Lib/test/test_userdict.py @@ -139,6 +139,9 @@ class UserDictTest(unittest.TestCase): t = UserDict.UserDict(x=42) self.assertEqual(t.pop("x"), 42) self.assertRaises(KeyError, t.pop, "x") + self.assertEqual(t.pop("x", 1), 1) + t["x"] = 42 + self.assertEqual(t.pop("x", 1), 42) # Test popitem t = UserDict.UserDict(x=42) @@ -242,6 +245,9 @@ class UserDictMixinTest(unittest.TestCase): self.assertEqual(s.pop(10), 'ten') self.assert_(10 not in s) s[10] = 'ten' + self.assertEqual(s.pop("x", 1), 1) + s["x"] = 42 + self.assertEqual(s.pop("x", 1), 42) # popitem k, v = s.popitem() |