mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
This commit is contained in:
parent
6f082297b2
commit
0eaabf1c05
3 changed files with 32 additions and 2 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue