summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2001-10-09 20:36:44 (GMT)
committerGuido van Rossum <guido@python.org>2001-10-09 20:36:44 (GMT)
commit12b22ff6d70cde60c49721f1ba8b88f47a9b4343 (patch)
tree81c93a87c0f260dbeca41ff250cc89a2e282d47b /Lib
parentfd38f8e638420defc586df77affd66093758ec43 (diff)
downloadcpython-12b22ff6d70cde60c49721f1ba8b88f47a9b4343.zip
cpython-12b22ff6d70cde60c49721f1ba8b88f47a9b4343.tar.gz
cpython-12b22ff6d70cde60c49721f1ba8b88f47a9b4343.tar.bz2
Add a bunch of tests for a list subclass that would have caught the
previous embarrassment (typeobject.c checking crashing minidom).
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_descr.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
index 5f0bb96..50e7d9d 100644
--- a/Lib/test/test_descr.py
+++ b/Lib/test/test_descr.py
@@ -1766,6 +1766,28 @@ def inherits():
verify(u[0:0].__class__ is unicode)
vereq(u[0:0], u"")
+ class sublist(list):
+ pass
+ a = sublist(range(5))
+ vereq(a, range(5))
+ a.append("hello")
+ vereq(a, range(5) + ["hello"])
+ a[5] = 5
+ vereq(a, range(6))
+ a.extend(range(6, 20))
+ vereq(a, range(20))
+ a[-5:] = []
+ vereq(a, range(15))
+ del a[10:15]
+ vereq(len(a), 10)
+ vereq(a, range(10))
+ vereq(list(a), range(10))
+ vereq(a[0], 0)
+ vereq(a[9], 9)
+ vereq(a[-10], 0)
+ vereq(a[-1], 9)
+ vereq(a[:5], range(5))
+
class CountedInput(file):
"""Counts lines read by self.readline().