diff options
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_itertools.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_itertools.py b/Lib/test/test_itertools.py index 355c690..3d02914 100644 --- a/Lib/test/test_itertools.py +++ b/Lib/test/test_itertools.py @@ -418,6 +418,13 @@ class TestBasicOps(unittest.TestCase): self.pickletest(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 resuse is CPython specific") def test_permutations_tuple_reuse(self): self.assertEqual(len(set(map(id, permutations('abcde', 3)))), 1) @@ -930,6 +937,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) |