Commit c9fadf99 authored by Fred Drake's avatar Fred Drake

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.
parent dad91dd1
......@@ -29,10 +29,11 @@ Passed test_nsattrs_wattr
Passed test_quoteattr_basic
Passed test_single_double_quoteattr
Passed test_single_quoteattr
Passed test_xmlgen_attr_escape
Passed test_xmlgen_basic
Passed test_xmlgen_content
Passed test_xmlgen_content_escape
Passed test_xmlgen_ignorable
Passed test_xmlgen_ns
Passed test_xmlgen_pi
36 tests, 0 failures
37 tests, 0 failures
......@@ -149,6 +149,22 @@ def test_xmlgen_content_escape():
return result.getvalue() == start + "<doc>&lt;huhei&amp;</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=\"'&quot;\"></e></doc>"
def test_xmlgen_ignorable():
result = StringIO()
gen = XMLGenerator(result)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment