Kaydet (Commit) 1c7b7f7f authored tarafından Raymond Hettinger's avatar Raymond Hettinger

Userlist.copy() wasn't returning a UserList.

üst 7b48432a
......@@ -887,7 +887,7 @@ class UserList(MutableSequence):
def pop(self, i=-1): return self.data.pop(i)
def remove(self, item): self.data.remove(item)
def clear(self): self.data.clear()
def copy(self): return self.data.copy()
def copy(self): return self.__class__(self)
def count(self, item): return self.data.count(item)
def index(self, item, *args): return self.data.index(item, *args)
def reverse(self): self.data.reverse()
......
......@@ -52,6 +52,12 @@ class UserListTest(list_tests.CommonTest):
return str(key) + '!!!'
self.assertEqual(next(iter(T((1,2)))), "0!!!")
def test_userlist_copy(self):
u = self.type2test([6, 8, 1, 9, 1])
v = u.copy()
self.assertEqual(u, v)
self.assertEqual(type(u), type(v))
def test_main():
support.run_unittest(UserListTest)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment