mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
dbm.gnu and dbm.ndbm accept both strings and bytes as keys and values. For the
former they are converted to bytes before being written to the DB. Closes issue 3799. Reviewed by Skip Montanaro.
This commit is contained in:
parent
50d5a1c373
commit
7317c1ef7a
7 changed files with 40 additions and 19 deletions
|
@ -20,9 +20,11 @@ class DbmTestCase(unittest.TestCase):
|
|||
self.d = dbm.ndbm.open(self.filename, 'c')
|
||||
self.assert_(self.d.keys() == [])
|
||||
self.d['a'] = 'b'
|
||||
self.d[b'bytes'] = b'data'
|
||||
self.d['12345678910'] = '019237410982340912840198242'
|
||||
self.d.keys()
|
||||
self.assert_(b'a' in self.d)
|
||||
self.assertEqual(self.d[b'bytes'], b'data')
|
||||
self.d.close()
|
||||
|
||||
def test_modes(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue