summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2000-03-31 00:17:46 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2000-03-31 00:17:46 (GMT)
commit6a973c711823f64d0362d0ba4b25ead4162df357 (patch)
treeb1042df5f08c5414f024849c381da0e964f069b8 /Lib/test
parent074c3e62d155349a69442f43e81a73883f222ea9 (diff)
downloadcpython-6a973c711823f64d0362d0ba4b25ead4162df357.zip
cpython-6a973c711823f64d0362d0ba4b25ead4162df357.tar.gz
cpython-6a973c711823f64d0362d0ba4b25ead4162df357.tar.bz2
robustify UserList constructor -- will now accept any sequence
add test cases for non-UserList class, tuple, & string
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_userlist.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_userlist.py b/Lib/test/test_userlist.py
index b684689..6c627c0 100644
--- a/Lib/test/test_userlist.py
+++ b/Lib/test/test_userlist.py
@@ -18,6 +18,17 @@ uu0 = UserList(u0)
uu1 = UserList(u1)
uu2 = UserList(u2)
+v = UserList(tuple(u))
+class OtherList:
+ def __init__(self, initlist):
+ self.__data = initlist
+ def __len__(self):
+ return len(self.__data)
+ def __getitem__(self, i):
+ return self.__data[i]
+v0 = UserList(OtherList(u0))
+vv = UserList("this is also a sequence")
+
# Test __repr__
assert str(u0) == str(l0)