diff options
author | Raymond Hettinger <python@rcn.com> | 2008-01-22 23:25:35 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2008-01-22 23:25:35 (GMT) |
commit | 1dfde1ddc0e1980d67bd19e187252d4e52b4f7ce (patch) | |
tree | 365fcd0e0d95e4ff612ca7184d441e6184f8b203 /Lib/test/test_itertools.py | |
parent | 86def6cb2b8d6d8c7f239795fa7af57c97a5890d (diff) | |
download | cpython-1dfde1ddc0e1980d67bd19e187252d4e52b4f7ce.zip cpython-1dfde1ddc0e1980d67bd19e187252d4e52b4f7ce.tar.gz cpython-1dfde1ddc0e1980d67bd19e187252d4e52b4f7ce.tar.bz2 |
Replace map(None, *iterables) with zip(*iterables).
Diffstat (limited to 'Lib/test/test_itertools.py')
-rw-r--r-- | Lib/test/test_itertools.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Lib/test/test_itertools.py b/Lib/test/test_itertools.py index 4c0af07..ae5eb90 100644 --- a/Lib/test/test_itertools.py +++ b/Lib/test/test_itertools.py @@ -236,7 +236,7 @@ class TestBasicOps(unittest.TestCase): self.assertEqual(list(izip_longest('abcdef')), list(zip('abcdef'))) self.assertEqual(list(izip_longest('abc', 'defg', **{})), - list(map(None, list('abc')+[None], 'defg'))) # empty keyword dict + list(izip(list('abc')+[None], 'defg'))) # empty keyword dict self.assertRaises(TypeError, izip_longest, 3) self.assertRaises(TypeError, izip_longest, range(3), 3) @@ -281,14 +281,17 @@ class TestBasicOps(unittest.TestCase): def test_imap(self): self.assertEqual(list(imap(operator.pow, range(3), range(1,7))), [0**1, 1**2, 2**3]) - self.assertEqual(list(imap(None, 'abc', range(5))), + def tupleize(*args): + return args + self.assertEqual(list(imap(tupleize, 'abc', range(5))), [('a',0),('b',1),('c',2)]) - self.assertEqual(list(imap(None, 'abc', count())), + self.assertEqual(list(imap(tupleize, 'abc', count())), [('a',0),('b',1),('c',2)]) - self.assertEqual(take(2,imap(None, 'abc', count())), + self.assertEqual(take(2,imap(tupleize, 'abc', count())), [('a',0),('b',1)]) self.assertEqual(list(imap(operator.pow, [])), []) self.assertRaises(TypeError, imap) + self.assertRaises(TypeError, list, imap(None, range(3), range(3))) self.assertRaises(TypeError, imap, operator.neg) self.assertRaises(TypeError, next, imap(10, range(5))) self.assertRaises(ValueError, next, imap(errfunc, [4], [5])) |