From: Fred Drake Date: Thu, 27 Jun 2002 19:41:51 +0000 (+0000) Subject: Integrate the tests for name interning from PyXML (test_pyexpat.py X-Git-Tag: v2.3c1~5187 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1add023b882273f928955df8f4a917952a89d910;p=python Integrate the tests for name interning from PyXML (test_pyexpat.py revision 1.12 in PyXML). --- diff --git a/Lib/test/test_pyexpat.py b/Lib/test/test_pyexpat.py index 404dc35531..22b3099b79 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(" ", 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