From c9fadf991c7905d9e483b65af8d9708fdcf44e71 Mon Sep 17 00:00:00 2001 From: Fred Drake Date: Tue, 7 Aug 2001 19:17:06 +0000 Subject: [PATCH] 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. --- Lib/test/output/test_sax | 3 ++- Lib/test/test_sax.py | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Lib/test/output/test_sax b/Lib/test/output/test_sax index b14cf94812d..8aa5a77c2f9 100644 --- a/Lib/test/output/test_sax +++ b/Lib/test/output/test_sax @@ -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 diff --git a/Lib/test/test_sax.py b/Lib/test/test_sax.py index 62705c9bcaf..dcf57d4526a 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 + "<huhei&" +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 \ + + "" + def test_xmlgen_ignorable(): result = StringIO() gen = XMLGenerator(result)