mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +00:00
merge from trunk
This commit is contained in:
parent
2d8dcdcb06
commit
f10a79aad4
40 changed files with 621 additions and 305 deletions
|
@ -140,6 +140,23 @@ class WhichDBTestCase(unittest.TestCase):
|
|||
|
||||
def setUp(self):
|
||||
delete_files()
|
||||
self.filename = test.support.TESTFN
|
||||
self.d = dbm.open(self.filename, 'c')
|
||||
self.d.close()
|
||||
|
||||
def test_keys(self):
|
||||
self.d = dbm.open(self.filename, 'c')
|
||||
self.assertEqual(self.d.keys(), [])
|
||||
a = [(b'a', b'b'), (b'12345678910', b'019237410982340912840198242')]
|
||||
for k, v in a:
|
||||
self.d[k] = v
|
||||
self.assertEqual(sorted(self.d.keys()), sorted(k for (k, v) in a))
|
||||
for k, v in a:
|
||||
self.assert_(k in self.d)
|
||||
self.assertEqual(self.d[k], v)
|
||||
self.assert_('xxx' not in self.d)
|
||||
self.assertRaises(KeyError, lambda: self.d['xxx'])
|
||||
self.d.close()
|
||||
|
||||
|
||||
def test_main():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue