summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2002-10-26 14:50:45 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2002-10-26 14:50:45 (GMT)
commit74b51ac1e5fb76250251a66d8d326baaaf1f1cee (patch)
tree2fd291bbcbfd19c22193e1102b204989ecebeab6 /Lib/test
parentedb6bff67fdb72718ed656d39ac71317ada37a04 (diff)
downloadcpython-74b51ac1e5fb76250251a66d8d326baaaf1f1cee.zip
cpython-74b51ac1e5fb76250251a66d8d326baaaf1f1cee.tar.gz
cpython-74b51ac1e5fb76250251a66d8d326baaaf1f1cee.tar.bz2
Patch #613256: Add nescape method to xml.sax.saxutils.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/output/test_sax5
-rw-r--r--Lib/test/test_sax.py14
2 files changed, 17 insertions, 2 deletions
diff --git a/Lib/test/output/test_sax b/Lib/test/output/test_sax
index 8aa5a77..cfb56cb 100644
--- a/Lib/test/output/test_sax
+++ b/Lib/test/output/test_sax
@@ -29,6 +29,9 @@ Passed test_nsattrs_wattr
Passed test_quoteattr_basic
Passed test_single_double_quoteattr
Passed test_single_quoteattr
+Passed test_unescape_all
+Passed test_unescape_basic
+Passed test_unescape_extra
Passed test_xmlgen_attr_escape
Passed test_xmlgen_basic
Passed test_xmlgen_content
@@ -36,4 +39,4 @@ Passed test_xmlgen_content_escape
Passed test_xmlgen_ignorable
Passed test_xmlgen_ns
Passed test_xmlgen_pi
-37 tests, 0 failures
+40 tests, 0 failures
diff --git a/Lib/test/test_sax.py b/Lib/test/test_sax.py
index 1200329..3c5b11a 100644
--- a/Lib/test/test_sax.py
+++ b/Lib/test/test_sax.py
@@ -8,7 +8,8 @@ try:
except SAXReaderNotAvailable:
# don't try to test this module if we cannot create a parser
raise ImportError("no XML parsers available")
-from xml.sax.saxutils import XMLGenerator, escape, quoteattr, XMLFilterBase
+from xml.sax.saxutils import XMLGenerator, escape, unescape, quoteattr, \
+ XMLFilterBase
from xml.sax.expatreader import create_parser
from xml.sax.xmlreader import InputSource, AttributesImpl, AttributesNSImpl
from cStringIO import StringIO
@@ -70,6 +71,17 @@ def test_escape_all():
def test_escape_extra():
return escape("Hei på deg", {"å" : "&aring;"}) == "Hei p&aring; deg"
+# ===== unescape
+
+def test_unescape_basic():
+ return unescape("Donald Duck &amp; Co") == "Donald Duck & Co"
+
+def test_unescape_all():
+ return unescape("&lt;Donald Duck &amp; Co&gt;") == "<Donald Duck & Co>"
+
+def test_unescape_extra():
+ return unescape("Hei på deg", {"å" : "&aring;"}) == "Hei p&aring; deg"
+
# ===== quoteattr
def test_quoteattr_basic():