mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-33383: Fix crash in get() of the dbm.ndbm database object. (#6630)
This commit is contained in:
parent
5779483299
commit
2e38cc3933
7 changed files with 38 additions and 7 deletions
|
@ -32,9 +32,12 @@ class TestGdbm(unittest.TestCase):
|
|||
self.assertIn(key, key_set)
|
||||
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'a'), b'b')
|
||||
self.assertIsNone(self.g.get(b'xxx'))
|
||||
self.assertEqual(self.g.get(b'xxx', b'foo'), b'foo')
|
||||
with self.assertRaises(KeyError):
|
||||
self.g['xxx']
|
||||
self.assertEqual(self.g.setdefault(b'xxx', b'foo'), b'foo')
|
||||
self.assertEqual(self.g[b'xxx'], b'foo')
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue