[Python-3000-checkins] r53857 - python/branches/p3yk/Lib/test/test_bsddb.py

brett.cannon python-3000-checkins at python.org
Thu Feb 22 07:12:21 CET 2007


Author: brett.cannon
Date: Thu Feb 22 07:12:19 2007
New Revision: 53857

Modified:
   python/branches/p3yk/Lib/test/test_bsddb.py
Log:
Fix obvious problems from switch to dict views.  Some tests still fail over
some reference count issue (I think).


Modified: python/branches/p3yk/Lib/test/test_bsddb.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_bsddb.py	(original)
+++ python/branches/p3yk/Lib/test/test_bsddb.py	Thu Feb 22 07:12:19 2007
@@ -94,7 +94,7 @@
         if not hasattr(self.f, 'iteritems'):
             return
 
-        di = self.d.items()
+        di = iter(self.d.items())
         while 1:
             try:
                 k, v = di.next()
@@ -105,7 +105,7 @@
         # it should behave the same as a dict.  modifying values
         # of existing keys should not break iteration.  (adding
         # or removing keys should)
-        fi = self.f.items()
+        fi = iter(self.f.items())
         while 1:
             try:
                 k, v = fi.next()
@@ -159,7 +159,7 @@
         # test the iterator interface (if present)
         if hasattr(self.f, 'iteritems'):
             if debug: print("D")
-            i = self.f.items()
+            i = iter(self.f.items())
             k,v = i.next()
             if debug: print("E")
             self.f[k] = "please don't deadlock"
@@ -198,7 +198,7 @@
         # do the bsddb._DBWithCursor _iter_mixin internals leak cursors?
         nc1 = len(self.f._cursor_refs)
         # create iterator
-        i = self.f.items()
+        i = iter(self.f.items())
         nc2 = len(self.f._cursor_refs)
         # use the iterator (should run to the first yeild, creating the cursor)
         k, v = i.next()
@@ -246,8 +246,7 @@
     def test_keyordering(self):
         if self.openmethod[0] is not bsddb.btopen:
             return
-        keys = self.d.keys()
-        keys.sort()
+        keys = sorted(self.d.keys())
         self.assertEqual(self.f.first()[0], keys[0])
         self.assertEqual(self.f.next()[0], keys[1])
         self.assertEqual(self.f.last()[0], keys[-1])


More information about the Python-3000-checkins mailing list