mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
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.
This commit is contained in:
parent
dad91dd1e9
commit
c9fadf991c
2 changed files with 18 additions and 1 deletions
|
|
@ -149,6 +149,22 @@ def test_xmlgen_content_escape():
|
|||
|
||||
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()
|
||||
gen = XMLGenerator(result)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue