mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Make bsddb use bytes as keys and values. Add StringKeys
and StringValues classes. Fix test suite.
This commit is contained in:
parent
33d2689fc9
commit
64ce5052e1
4 changed files with 182 additions and 50 deletions
|
@ -12,8 +12,12 @@ from test import test_support
|
|||
class TestBSDDB(unittest.TestCase):
|
||||
openflag = 'c'
|
||||
|
||||
def do_open(self, *args, **kw):
|
||||
# openmethod is a list so that it's not mistaken as an instance method
|
||||
return bsddb.StringValues(bsddb.StringKeys(self.openmethod[0](*args, **kw)))
|
||||
|
||||
def setUp(self):
|
||||
self.f = self.openmethod[0](self.fname, self.openflag, cachesize=32768)
|
||||
self.f = self.do_open(self.fname, self.openflag, cachesize=32768)
|
||||
self.d = dict(q='Guido', w='van', e='Rossum', r='invented', t='Python', y='')
|
||||
for k, v in self.d.items():
|
||||
self.f[k] = v
|
||||
|
@ -47,7 +51,7 @@ class TestBSDDB(unittest.TestCase):
|
|||
# so finish here.
|
||||
return
|
||||
self.f.close()
|
||||
self.f = self.openmethod[0](self.fname, 'w')
|
||||
self.f = self.do_open(self.fname, 'w')
|
||||
for k, v in self.d.items():
|
||||
self.assertEqual(self.f[k], v)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue