MCPcopy Index your code
hub / github.com/python/cpython / test_map

Method test_map

Lib/test/test_itertools.py:1138–1153  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1136 self.assertEqual(repr(repeat('a', times=-2)), "repeat('a', 0)")
1137
1138 def test_map(self):
1139 self.assertEqual(list(map(operator.pow, range(3), range(1,7))),
1140 [0**1, 1**2, 2**3])
1141 self.assertEqual(list(map(tupleize, 'abc', range(5))),
1142 [('a',0),('b',1),('c',2)])
1143 self.assertEqual(list(map(tupleize, 'abc', count())),
1144 [('a',0),('b',1),('c',2)])
1145 self.assertEqual(take(2,map(tupleize, 'abc', count())),
1146 [('a',0),('b',1)])
1147 self.assertEqual(list(map(operator.pow, [])), [])
1148 self.assertRaises(TypeError, map)
1149 self.assertRaises(TypeError, list, map(None, range(3), range(3)))
1150 self.assertRaises(TypeError, map, operator.neg)
1151 self.assertRaises(TypeError, next, map(10, range(5)))
1152 self.assertRaises(ValueError, next, map(errfunc, [4], [5]))
1153 self.assertRaises(TypeError, next, map(onearg, [4], [5]))
1154
1155 def test_starmap(self):
1156 self.assertEqual(list(starmap(operator.pow, zip(range(3), range(1,7)))),

Callers

nothing calls this directly

Calls 5

listClass · 0.85
countFunction · 0.85
takeFunction · 0.85
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected