[Python-3000-checkins] r53855 - in python/branches/p3yk/Lib: dumbdbm.py test/test_dumbdbm.py
brett.cannon
python-3000-checkins at python.org
Thu Feb 22 06:04:35 CET 2007
Author: brett.cannon
Date: Thu Feb 22 06:04:32 2007
New Revision: 53855
Modified:
python/branches/p3yk/Lib/dumbdbm.py
python/branches/p3yk/Lib/test/test_dumbdbm.py
Log:
Fix dumbdbm and test_dumbdbm to work with dict views. Bug in dumbdbm was from
dict views not being iterators but just iterables.
Modified: python/branches/p3yk/Lib/dumbdbm.py
==============================================================================
--- python/branches/p3yk/Lib/dumbdbm.py (original)
+++ python/branches/p3yk/Lib/dumbdbm.py Thu Feb 22 06:04:32 2007
@@ -202,7 +202,7 @@
return key in self._index
def iterkeys(self):
- return self._index.keys()
+ return iter(self._index.keys())
__iter__ = iterkeys
def __len__(self):
Modified: python/branches/p3yk/Lib/test/test_dumbdbm.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_dumbdbm.py (original)
+++ python/branches/p3yk/Lib/test/test_dumbdbm.py Thu Feb 22 06:04:32 2007
@@ -32,7 +32,7 @@
def test_dumbdbm_creation(self):
f = dumbdbm.open(_fname, 'c')
- self.assertEqual(f.keys(), [])
+ self.assertEqual(list(f.keys()), [])
for key in self._dict:
f[key] = self._dict[key]
self.read_helper(f)
@@ -128,10 +128,8 @@
f.close()
def keys_helper(self, f):
- keys = f.keys()
- keys.sort()
- dkeys = self._dict.keys()
- dkeys.sort()
+ keys = sorted(f.keys())
+ dkeys = sorted(self._dict.keys())
self.assertEqual(keys, dkeys)
return keys
@@ -156,10 +154,8 @@
f.close()
f = dumbdbm.open(_fname)
- expected = d.items()
- expected.sort()
- got = f.items()
- got.sort()
+ expected = sorted(d.items())
+ got = sorted(f.items())
self.assertEqual(expected, got)
f.close()
More information about the Python-3000-checkins
mailing list