diff options
author | Senthil Kumaran <orsenthil@gmail.com> | 2010-01-08 18:41:40 +0000 |
---|---|---|
committer | Senthil Kumaran <orsenthil@gmail.com> | 2010-01-08 18:41:40 +0000 |
commit | 3ddc435af6873c6304058d7bcbcb19ee4fba7781 (patch) | |
tree | c7a03cf0a8b856bae2ebebba55b09f775845c7ca /Lib/test/test_iter.py | |
parent | 3194d1454cbc11ec477d83fff3fc749972107d29 (diff) | |
download | cpython-git-3ddc435af6873c6304058d7bcbcb19ee4fba7781.tar.gz |
Fixing - Issue7026 - RuntimeError: dictionary changed size during iteration. Patch by flox
Diffstat (limited to 'Lib/test/test_iter.py')
-rw-r--r-- | Lib/test/test_iter.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/Lib/test/test_iter.py b/Lib/test/test_iter.py index f5d6e686de..5e96c6ddae 100644 --- a/Lib/test/test_iter.py +++ b/Lib/test/test_iter.py @@ -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) |