summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2002-06-27 19:41:51 (GMT)
committerFred Drake <fdrake@acm.org>2002-06-27 19:41:51 (GMT)
commit1add023b882273f928955df8f4a917952a89d910 (patch)
treec9ed9665987cb47ca46752b3bf351523cb44671a /Lib
parentb91a36b2305c348ac4c27c823d75c11ea37e603c (diff)
downloadcpython-1add023b882273f928955df8f4a917952a89d910.zip
cpython-1add023b882273f928955df8f4a917952a89d910.tar.gz
cpython-1add023b882273f928955df8f4a917952a89d910.tar.bz2
Integrate the tests for name interning from PyXML (test_pyexpat.py
revision 1.12 in PyXML).
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_pyexpat.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/test/test_pyexpat.py b/Lib/test/test_pyexpat.py
index 404dc35..22b3099 100644
--- a/Lib/test/test_pyexpat.py
+++ b/Lib/test/test_pyexpat.py
@@ -200,3 +200,21 @@ else:
# http://mail.python.org/pipermail/xml-sig/2001-April/005202.html
#
expat.ParserCreate(namespace_separator='') # too short
+
+# Test the interning machinery.
+p = expat.ParserCreate()
+L = []
+def collector(name, *args):
+ L.append(name)
+p.StartElementHandler = collector
+p.EndElementHandler = collector
+p.Parse("<e> <e/> <e></e> </e>", 1)
+tag = L[0]
+if len(L) != 6:
+ print "L should only contain 6 entries; found", len(L)
+for entry in L:
+ if tag is not entry:
+ print "expected L to contain many references to the same string",
+ print "(it didn't)"
+ print "L =", `L`
+ break