]> granicus.if.org Git - python/commitdiff
Fix test_iterlen by returning the iterator of dict views. Problem is that
authorBrett Cannon <bcannon@gmail.com>
Thu, 22 Feb 2007 04:45:13 +0000 (04:45 +0000)
committerBrett Cannon <bcannon@gmail.com>
Thu, 22 Feb 2007 04:45:13 +0000 (04:45 +0000)
iteritems and itervalues' previous object were both an iterator *and* and
iterable.  The tests expected an iterator but were given an iterable.

Should the 2to3 conversion for iter(values|items|keys) change the code to
``iter(dict.keys())`` to be more compatible?

BROKEN
Lib/test/test_iterlen.py

diff --git a/BROKEN b/BROKEN
index 7515740db77b67fba7cbd64db4f91852ca29197d..c9d7a04a41c11088861d71e62b22f78472b7d6fe 100644 (file)
--- a/BROKEN
+++ b/BROKEN
@@ -1,2 +1,2 @@
     test_bsddb test_bsddb3 test_compile test_dumbdbm
-    test_importhooks test_iter test_iterlen
+    test_importhooks test_iter
index e9a6a688167ac7c2ffa7e567bf456a15de265fc2..8ff1d6bb17182a03c4e9cfd924a3f398b4fdf1a6 100644 (file)
@@ -139,14 +139,14 @@ class TestDictItems(TestTemporarilyImmutable):
 
     def setUp(self):
         d = dict.fromkeys(xrange(n))
-        self.it = d.items()
+        self.it = iter(d.items())
         self.mutate = d.popitem
 
 class TestDictValues(TestTemporarilyImmutable):
 
     def setUp(self):
         d = dict.fromkeys(xrange(n))
-        self.it = d.values()
+        self.it = iter(d.values())
         self.mutate = d.popitem
 
 class TestSet(TestTemporarilyImmutable):