mirror of
https://github.com/python/cpython.git
synced 2025-11-01 14:11:41 +00:00
Make starmap() match its pure python definition and accept any itertable input (not just tuples).
This commit is contained in:
parent
3ad2acc857
commit
473170908e
4 changed files with 15 additions and 8 deletions
|
|
@ -292,7 +292,8 @@ def test_starmap(self):
|
|||
self.assertEqual(take(3, starmap(operator.pow, izip(count(), count(1)))),
|
||||
[0**1, 1**2, 2**3])
|
||||
self.assertEqual(list(starmap(operator.pow, [])), [])
|
||||
self.assertRaises(TypeError, list, starmap(operator.pow, [[4,5]]))
|
||||
self.assertEqual(list(starmap(operator.pow, [iter([4,5])])), [4**5])
|
||||
self.assertRaises(TypeError, list, starmap(operator.pow, [None]))
|
||||
self.assertRaises(TypeError, starmap)
|
||||
self.assertRaises(TypeError, starmap, operator.pow, [(4,5)], 'extra')
|
||||
self.assertRaises(TypeError, starmap(10, [(4,5)]).next)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue