[Python-checkins] CVS: python/dist/src/Lib/test test_sax.py,1.17,1.18
Fred L. Drake
fdrake@users.sourceforge.net
Tue, 07 Aug 2001 12:17:08 -0700
Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv7522/test
Modified Files:
test_sax.py
Log Message:
Add a test that xml.sax.saxutils.XMLGenerator does the right thing
when quoting attribute values that contain single & double quotes.
This provides the rest of the regression test for SF bug #440351.
Index: test_sax.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sax.py,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** test_sax.py 2001/07/19 16:10:15 1.17
--- test_sax.py 2001/08/07 19:17:05 1.18
***************
*** 150,153 ****
--- 150,169 ----
return result.getvalue() == start + "<doc><huhei&</doc>"
+ def test_xmlgen_attr_escape():
+ result = StringIO()
+ gen = XMLGenerator(result)
+
+ gen.startDocument()
+ gen.startElement("doc", {"a": '"'})
+ gen.startElement("e", {"a": "'"})
+ gen.endElement("e")
+ gen.startElement("e", {"a": "'\""})
+ gen.endElement("e")
+ gen.endElement("doc")
+ gen.endDocument()
+
+ return result.getvalue() == start \
+ + "<doc a='\"'><e a=\"'\"></e><e a=\"'"\"></e></doc>"
+
def test_xmlgen_ignorable():
result = StringIO()