summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_dbm_gnu.py
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2008-11-25 19:19:17 (GMT)
committerBrett Cannon <bcannon@gmail.com>2008-11-25 19:19:17 (GMT)
commit7317c1ef7aaba7deda66b7fa917d09e68d83635b (patch)
tree20de56e7bef3651ffbe837660673f76a1b54a1c5 /Lib/test/test_dbm_gnu.py
parent50d5a1c37324405104a097389515a0ef4f9705f3 (diff)
downloadcpython-7317c1ef7aaba7deda66b7fa917d09e68d83635b.zip
cpython-7317c1ef7aaba7deda66b7fa917d09e68d83635b.tar.gz
cpython-7317c1ef7aaba7deda66b7fa917d09e68d83635b.tar.bz2
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.
Diffstat (limited to 'Lib/test/test_dbm_gnu.py')
-rwxr-xr-xLib/test/test_dbm_gnu.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/test/test_dbm_gnu.py b/Lib/test/test_dbm_gnu.py
index eddb970..0049aaa 100755
--- a/Lib/test/test_dbm_gnu.py
+++ b/Lib/test/test_dbm_gnu.py
@@ -20,9 +20,11 @@ class TestGdbm(unittest.TestCase):
self.assertEqual(self.g.keys(), [])
self.g['a'] = 'b'
self.g['12345678910'] = '019237410982340912840198242'
+ self.g[b'bytes'] = b'data'
key_set = set(self.g.keys())
self.assertEqual(key_set, set([b'a', b'12345678910']))
self.assert_(b'a' in self.g)
+ self.assertEqual(self.g[b'bytes'], b'data')
key = self.g.firstkey()
while key:
self.assert_(key in key_set)