summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_sax.py
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/test_sax.py
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/test_sax.py')
-rw-r--r--Lib/test/test_sax.py14
1 files changed, 13 insertions, 1 deletions
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():