mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
Fixing - Issue7026 - RuntimeError: dictionary changed size during iteration. Patch by flox
This commit is contained in:
parent
3194d1454c
commit
3ddc435af6
107 changed files with 794 additions and 436 deletions
|
@ -1,7 +1,8 @@
|
|||
# Test iterators.
|
||||
|
||||
import unittest
|
||||
from test.test_support import run_unittest, TESTFN, unlink, have_unicode
|
||||
from test.test_support import run_unittest, TESTFN, unlink, have_unicode, \
|
||||
check_warnings
|
||||
|
||||
# Test result of triple loop (too big to inline)
|
||||
TRIPLETS = [(0, 0, 0), (0, 0, 1), (0, 0, 2),
|
||||
|
@ -395,7 +396,12 @@ class TestCase(unittest.TestCase):
|
|||
pass
|
||||
|
||||
# Test map()'s use of iterators.
|
||||
def test_builtin_map(self):
|
||||
def test_deprecated_builtin_map(self):
|
||||
# Silence Py3k warning
|
||||
with check_warnings():
|
||||
self._test_builtin_map()
|
||||
|
||||
def _test_builtin_map(self):
|
||||
self.assertEqual(map(None, SequenceClass(5)), range(5))
|
||||
self.assertEqual(map(lambda x: x+1, SequenceClass(5)), range(1, 6))
|
||||
|
||||
|
@ -506,7 +512,12 @@ class TestCase(unittest.TestCase):
|
|||
self.assertEqual(zip(x, y), expected)
|
||||
|
||||
# Test reduces()'s use of iterators.
|
||||
def test_builtin_reduce(self):
|
||||
def test_deprecated_builtin_reduce(self):
|
||||
# Silence Py3k warning
|
||||
with check_warnings():
|
||||
self._test_builtin_reduce()
|
||||
|
||||
def _test_builtin_reduce(self):
|
||||
from operator import add
|
||||
self.assertEqual(reduce(add, SequenceClass(5)), 10)
|
||||
self.assertEqual(reduce(add, SequenceClass(5), 42), 52)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue