diff options
author | Guido van Rossum <guido@python.org> | 2006-08-24 19:48:10 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2006-08-24 19:48:10 (GMT) |
commit | 801f0d78b5582a325d489831b991adb873067e80 (patch) | |
tree | 4a5bde7b1386ea73ca0161ffb205911459fff63c /Lib/test/test_builtin.py | |
parent | d38abe94841194e3c92bfa2cfb89df36c82607a1 (diff) | |
download | cpython-801f0d78b5582a325d489831b991adb873067e80.zip cpython-801f0d78b5582a325d489831b991adb873067e80.tar.gz cpython-801f0d78b5582a325d489831b991adb873067e80.tar.bz2 |
Make built-in zip() equal to itertools.izip().
I mea, *really* equal -- for now, the implementation just imports
itertools. :-)
The only other changes necessary were various unit tests that were
assuming zip() returns a real list. No "real" code made this assumption.
Diffstat (limited to 'Lib/test/test_builtin.py')
-rw-r--r-- | Lib/test/test_builtin.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py index d3a272b..d4605e1 100644 --- a/Lib/test/test_builtin.py +++ b/Lib/test/test_builtin.py @@ -1554,18 +1554,18 @@ class BuiltinTest(unittest.TestCase): a = (1, 2, 3) b = (4, 5, 6) t = [(1, 4), (2, 5), (3, 6)] - self.assertEqual(zip(a, b), t) + self.assertEqual(list(zip(a, b)), t) b = [4, 5, 6] - self.assertEqual(zip(a, b), t) + self.assertEqual(list(zip(a, b)), t) b = (4, 5, 6, 7) - self.assertEqual(zip(a, b), t) + self.assertEqual(list(zip(a, b)), t) class I: def __getitem__(self, i): if i < 0 or i > 2: raise IndexError return i + 4 - self.assertEqual(zip(a, I()), t) - self.assertEqual(zip(), []) - self.assertEqual(zip(*[]), []) + self.assertEqual(list(zip(a, I())), t) + self.assertEqual(list(zip()), []) + self.assertEqual(list(zip(*[])), []) self.assertRaises(TypeError, zip, None) class G: pass @@ -1581,7 +1581,7 @@ class BuiltinTest(unittest.TestCase): else: return i self.assertEqual( - zip(SequenceWithoutALength(), xrange(2**30)), + list(zip(SequenceWithoutALength(), xrange(2**30))), list(enumerate(range(5))) ) @@ -1591,7 +1591,7 @@ class BuiltinTest(unittest.TestCase): raise ValueError else: return i - self.assertRaises(ValueError, zip, BadSeq(), BadSeq()) + self.assertRaises(ValueError, list, zip(BadSeq(), BadSeq())) class TestSorted(unittest.TestCase): |