[Python-checkins] python/dist/src/Lib/test test_pyexpat.py,1.10,1.11
fdrake@users.sourceforge.net
fdrake@users.sourceforge.net
Thu, 27 Jun 2002 12:41:53 -0700
Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv20963/Lib/test
Modified Files:
test_pyexpat.py
Log Message:
Integrate the tests for name interning from PyXML (test_pyexpat.py
revision 1.12 in PyXML).
Index: test_pyexpat.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pyexpat.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** test_pyexpat.py 30 Jul 2001 21:47:25 -0000 1.10
--- test_pyexpat.py 27 Jun 2002 19:41:51 -0000 1.11
***************
*** 201,202 ****
--- 201,220 ----
#
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