Move UserList to collections.

This commit is contained in:
Raymond Hettinger 2008-02-12 20:03:09 +00:00
parent 4513ef8b7a
commit 53dbe39b46
14 changed files with 133 additions and 143 deletions

View file

@ -4,7 +4,7 @@ Common tests shared by test_str, test_unicode, test_userstring and test_string.
import unittest, string, sys, struct
from test import test_support
from UserList import UserList
from collections import UserList
class Sequence:
def __init__(self, seq='wxyz'): self.seq = seq

View file

@ -1,7 +1,7 @@
import unittest
from test import test_support
from bisect import bisect_right, bisect_left, insort_left, insort_right, insort, bisect
from UserList import UserList
from collections import UserList
class TestBisect(unittest.TestCase):

View file

@ -5,7 +5,7 @@ from test.test_support import fcmp, TESTFN, unlink, run_unittest, \
run_with_locale
from operator import neg
import sys, warnings, random, collections, io, rational, fractions
import sys, warnings, random, collections, io, fractions
warnings.filterwarnings("ignore", "hex../oct.. of negative int",
FutureWarning, __name__)
warnings.filterwarnings("ignore", "integer argument expected",
@ -210,7 +210,7 @@ class BuiltinTest(unittest.TestCase):
# verify that circular objects are not handled
a = []; a.append(a)
b = []; b.append(b)
from UserList import UserList
from collections import UserList
c = UserList(); c.append(c)
self.assertRaises(RuntimeError, cmp, a, b)
self.assertRaises(RuntimeError, cmp, b, c)

View file

@ -1,6 +1,5 @@
from test.test_support import verify, verbose, TestFailed, sortdict
from UserList import UserList
from collections import UserDict
from collections import UserDict, UserList
def e(a, b):
print(a, b)

View file

@ -5,7 +5,7 @@ from array import array
from weakref import proxy
from test.test_support import TESTFN, findfile, run_unittest
from UserList import UserList
from collections import UserList
class AutoFileTests(unittest.TestCase):
# file tests for which a test file is automatically set up

View file

@ -7,7 +7,7 @@ from array import array
from weakref import proxy
from test.test_support import TESTFN, findfile, run_unittest
from UserList import UserList
from collections import UserList
import _fileio

View file

@ -254,7 +254,7 @@ class MiscTest(unittest.TestCase):
def test_recursion(self):
# Check that comparison for recursive objects fails gracefully
from UserList import UserList
from collections import UserList
a = UserList()
b = UserList()
a.append(b)

View file

@ -1,6 +1,6 @@
# Check every path through every method of UserList
from UserList import UserList
from collections import UserList
import unittest
from test import test_support, list_tests

View file

@ -1,7 +1,7 @@
import gc
import sys
import unittest
import UserList
import collections
import weakref
from test import test_support
@ -157,7 +157,7 @@ class ReferencesTestCase(TestBase):
o = C()
self.check_proxy(o, weakref.proxy(o))
L = UserList.UserList()
L = collections.UserList()
p = weakref.proxy(L)
self.failIf(p, "proxy for empty UserList should be false")
p.append(12)
@ -171,11 +171,11 @@ class ReferencesTestCase(TestBase):
p[1] = 5
self.assertEqual(L[1], 5)
self.assertEqual(p[1], 5)
L2 = UserList.UserList(L)
L2 = collections.UserList(L)
p2 = weakref.proxy(L2)
self.assertEqual(p, p2)
## self.assertEqual(repr(L2), repr(p2))
L3 = UserList.UserList(range(10))
L3 = collections.UserList(range(10))
p3 = weakref.proxy(L3)
self.assertEqual(L3[:], p3[:])
self.assertEqual(L3[5:], p3[5:])