summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_iter.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2003-08-02 07:42:57 (GMT)
committerRaymond Hettinger <python@rcn.com>2003-08-02 07:42:57 (GMT)
commiteaef61511656071194565878dc80c46096d46415 (patch)
treeb3e761f4c79ace0c0baeeb3ed845afd14ca666bb /Lib/test/test_iter.py
parent9463792c686c312dcf85c649b7183eae25403945 (diff)
downloadcpython-eaef61511656071194565878dc80c46096d46415.zip
cpython-eaef61511656071194565878dc80c46096d46415.tar.gz
cpython-eaef61511656071194565878dc80c46096d46415.tar.bz2
As discussed on python-dev, changed builtin.zip() to handle zero arguments
by returning an empty list instead of raising a TypeError.
Diffstat (limited to 'Lib/test/test_iter.py')
-rw-r--r--Lib/test/test_iter.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/test/test_iter.py b/Lib/test/test_iter.py
index 383fce3..f83de78 100644
--- a/Lib/test/test_iter.py
+++ b/Lib/test/test_iter.py
@@ -423,7 +423,10 @@ class TestCase(unittest.TestCase):
# Test zip()'s use of iterators.
def test_builtin_zip(self):
- self.assertRaises(TypeError, zip)
+ self.assertEqual(zip(), [])
+ self.assertEqual(zip(*[]), [])
+ self.assertEqual(zip(*[(1, 2), 'ab']), [(1, 'a'), (2, 'b')])
+
self.assertRaises(TypeError, zip, None)
self.assertRaises(TypeError, zip, range(10), 42)
self.assertRaises(TypeError, zip, range(10), zip)