summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-12-04 09:14:36 (GMT)
committerGeorg Brandl <georg@python.org>2010-12-04 09:14:36 (GMT)
commitd9e833c70a22558236fc863250870837d4ad8b16 (patch)
treeb9bb6ff8d06dcb05975f5281d48a55babbb8582a /Lib/test
parentda72231c9feeef6983f05dc963a69cf6f1c8de29 (diff)
downloadcpython-d9e833c70a22558236fc863250870837d4ad8b16.zip
cpython-d9e833c70a22558236fc863250870837d4ad8b16.tar.gz
cpython-d9e833c70a22558236fc863250870837d4ad8b16.tar.bz2
#6045: provide at least get() and setdefault() for all dbm modules.
Diffstat (limited to 'Lib/test')
-rwxr-xr-xLib/test/test_dbm_gnu.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_dbm_gnu.py b/Lib/test/test_dbm_gnu.py
index dad56e6..ce96ce4 100755
--- a/Lib/test/test_dbm_gnu.py
+++ b/Lib/test/test_dbm_gnu.py
@@ -32,6 +32,10 @@ class TestGdbm(unittest.TestCase):
key_set.remove(key)
key = self.g.nextkey(key)
self.assertRaises(KeyError, lambda: self.g['xxx'])
+ # get() and setdefault() work as in the dict interface
+ self.assertEqual(self.g.get(b'xxx', b'foo'), b'foo')
+ self.assertEqual(self.g.setdefault(b'xxx', b'foo'), b'foo')
+ self.assertEqual(self.g[b'xxx'], b'foo')
def test_error_conditions(self):
# Try to open a non-existent database.