diff options
author | Fred Drake <fdrake@acm.org> | 2001-08-07 19:17:06 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2001-08-07 19:17:06 (GMT) |
commit | c9fadf991c7905d9e483b65af8d9708fdcf44e71 (patch) | |
tree | 4ad8920b9988cbec86ebb6a5f50f44ff46071945 /Lib/test/test_sax.py | |
parent | dad91dd1e90222cfae4543eb290e2b2fa99192c2 (diff) | |
download | cpython-c9fadf991c7905d9e483b65af8d9708fdcf44e71.zip cpython-c9fadf991c7905d9e483b65af8d9708fdcf44e71.tar.gz cpython-c9fadf991c7905d9e483b65af8d9708fdcf44e71.tar.bz2 |
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.
Diffstat (limited to 'Lib/test/test_sax.py')
-rw-r--r-- | Lib/test/test_sax.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/test/test_sax.py b/Lib/test/test_sax.py index 62705c9..dcf57d4 100644 --- a/Lib/test/test_sax.py +++ b/Lib/test/test_sax.py @@ -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) |