mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Patch #613256: Add nescape method to xml.sax.saxutils.
This commit is contained in:
parent
edb6bff67f
commit
74b51ac1e5
6 changed files with 58 additions and 8 deletions
|
@ -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", {"å" : "å"}) == "Hei på deg"
|
||||
|
||||
# ===== unescape
|
||||
|
||||
def test_unescape_basic():
|
||||
return unescape("Donald Duck & Co") == "Donald Duck & Co"
|
||||
|
||||
def test_unescape_all():
|
||||
return unescape("<Donald Duck & Co>") == "<Donald Duck & Co>"
|
||||
|
||||
def test_unescape_extra():
|
||||
return unescape("Hei på deg", {"å" : "å"}) == "Hei på deg"
|
||||
|
||||
# ===== quoteattr
|
||||
|
||||
def test_quoteattr_basic():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue