summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2015-02-02 02:36:01 (GMT)
committerBenjamin Peterson <benjamin@python.org>2015-02-02 02:36:01 (GMT)
commit5d0bb852a25d010cc1aacf661d26a6bae1c8bf1a (patch)
tree54d6a3f6338a8fec9015cf708f12007b4007e4bb /Lib
parent38d9772622fa13f7dc1033cd29bad1b15a31c8b4 (diff)
parentc468b537cd227ce5484500a8f8ea7e932eabc7d5 (diff)
downloadcpython-5d0bb852a25d010cc1aacf661d26a6bae1c8bf1a.zip
cpython-5d0bb852a25d010cc1aacf661d26a6bae1c8bf1a.tar.gz
cpython-5d0bb852a25d010cc1aacf661d26a6bae1c8bf1a.tar.bz2
merge 3.4 (#23364, #23363)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_itertools.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_itertools.py b/Lib/test/test_itertools.py
index 960cb91..d0167e5 100644
--- a/Lib/test/test_itertools.py
+++ b/Lib/test/test_itertools.py
@@ -426,6 +426,13 @@ class TestBasicOps(unittest.TestCase):
for proto in range(pickle.HIGHEST_PROTOCOL + 1):
self.pickletest(proto, permutations(values, r)) # test pickling
+ @support.bigaddrspacetest
+ def test_permutations_overflow(self):
+ with self.assertRaises(OverflowError):
+ permutations("A", 2**30)
+ with self.assertRaises(OverflowError):
+ permutations("A", 2, 2**30)
+
@support.impl_detail("tuple reuse is specific to CPython")
def test_permutations_tuple_reuse(self):
self.assertEqual(len(set(map(id, permutations('abcde', 3)))), 1)
@@ -955,6 +962,11 @@ class TestBasicOps(unittest.TestCase):
args = map(iter, args)
self.assertEqual(len(list(product(*args))), expected_len)
+ @support.bigaddrspacetest
+ def test_product_overflow(self):
+ with self.assertRaises(OverflowError):
+ product(["a"]*(2**16), repeat=2**16)
+
@support.impl_detail("tuple reuse is specific to CPython")
def test_product_tuple_reuse(self):
self.assertEqual(len(set(map(id, product('abc', 'def')))), 1)