mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
As discussed on python-dev, changed builtin.zip() to handle zero arguments
by returning an empty list instead of raising a TypeError.
This commit is contained in:
parent
9463792c68
commit
eaef615116
5 changed files with 20 additions and 11 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue