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

Method test_accumulate

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

Source from the content-addressed store, hash-verified

2208class TestVariousIteratorArgs(unittest.TestCase):
2209
2210 def test_accumulate(self):
2211 s = [1,2,3,4,5]
2212 r = [1,3,6,10,15]
2213 n = len(s)
2214 for g in (G, I, Ig, L, R):
2215 self.assertEqual(list(accumulate(g(s))), r)
2216 self.assertEqual(list(accumulate(S(s))), [])
2217 self.assertRaises(TypeError, accumulate, X(s))
2218 self.assertRaises(TypeError, accumulate, N(s))
2219 self.assertRaises(ZeroDivisionError, list, accumulate(E(s)))
2220
2221 def test_batched(self):
2222 s = 'abcde'

Callers

nothing calls this directly

Calls 8

listClass · 0.85
gFunction · 0.70
SClass · 0.70
XClass · 0.70
NClass · 0.70
EClass · 0.70
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected