mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +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
|
@ -4,7 +4,7 @@ Tests common to list and UserList.UserList
|
|||
|
||||
import sys
|
||||
import os
|
||||
|
||||
import warnings
|
||||
from test import test_support, seq_tests
|
||||
|
||||
class CommonTest(seq_tests.CommonTest):
|
||||
|
@ -36,7 +36,9 @@ class CommonTest(seq_tests.CommonTest):
|
|||
|
||||
self.assertEqual(str(a0), str(l0))
|
||||
self.assertEqual(repr(a0), repr(l0))
|
||||
self.assertEqual(`a2`, `l2`)
|
||||
# Silence Py3k warning
|
||||
with test_support.check_warnings():
|
||||
self.assertEqual(eval('`a2`'), eval('`l2`'))
|
||||
self.assertEqual(str(a2), "[0, 1, 2]")
|
||||
self.assertEqual(repr(a2), "[0, 1, 2]")
|
||||
|
||||
|
@ -421,6 +423,13 @@ class CommonTest(seq_tests.CommonTest):
|
|||
self.assertRaises(TypeError, u.reverse, 42)
|
||||
|
||||
def test_sort(self):
|
||||
with warnings.catch_warnings():
|
||||
# Silence Py3k warning
|
||||
warnings.filterwarnings("ignore", "the cmp argument is not supported",
|
||||
DeprecationWarning)
|
||||
self._test_sort()
|
||||
|
||||
def _test_sort(self):
|
||||
u = self.type2test([1, 0])
|
||||
u.sort()
|
||||
self.assertEqual(u, [0, 1])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue