summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_itertools.py
diff options
context:
space:
mode:
authorLisa Roach <lisaroach14@gmail.com>2018-09-24 00:34:59 (GMT)
committerGitHub <noreply@github.com>2018-09-24 00:34:59 (GMT)
commit9718b59ee5f2416cdb8116ea5837b062faf0d9f8 (patch)
tree4cb5ba002be73a33680252e355c13800f4e9c42c /Lib/test/test_itertools.py
parentc87d9f406bb23657c1b4cd63017bb7bd7693a1fb (diff)
downloadcpython-9718b59ee5f2416cdb8116ea5837b062faf0d9f8.zip
cpython-9718b59ee5f2416cdb8116ea5837b062faf0d9f8.tar.gz
cpython-9718b59ee5f2416cdb8116ea5837b062faf0d9f8.tar.bz2
bpo-34659: Adds initial kwarg to itertools.accumulate() (GH-9345)
Diffstat (limited to 'Lib/test/test_itertools.py')
-rw-r--r--Lib/test/test_itertools.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_itertools.py b/Lib/test/test_itertools.py
index cbbb4c4..ea060a9 100644
--- a/Lib/test/test_itertools.py
+++ b/Lib/test/test_itertools.py
@@ -147,6 +147,12 @@ class TestBasicOps(unittest.TestCase):
list(accumulate(s, chr)) # unary-operation
for proto in range(pickle.HIGHEST_PROTOCOL + 1):
self.pickletest(proto, accumulate(range(10))) # test pickling
+ self.pickletest(proto, accumulate(range(10), initial=7))
+ self.assertEqual(list(accumulate([10, 5, 1], initial=None)), [10, 15, 16])
+ self.assertEqual(list(accumulate([10, 5, 1], initial=100)), [100, 110, 115, 116])
+ self.assertEqual(list(accumulate([], initial=100)), [100])
+ with self.assertRaises(TypeError):
+ list(accumulate([10, 20], 100))
def test_chain(self):