[Python-checkins] python/dist/src/Lib/test test_sax.py,1.22,1.23

loewis@users.sourceforge.net loewis@users.sourceforge.net
Sat, 26 Oct 2002 07:50:47 -0700


Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv29237/Lib/test

Modified Files:
	test_sax.py 
Log Message:
Patch #613256: Add nescape method to xml.sax.saxutils.


Index: test_sax.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sax.py,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** test_sax.py	12 Sep 2002 17:02:01 -0000	1.22
--- test_sax.py	26 Oct 2002 14:50:45 -0000	1.23
***************
*** 9,13 ****
      # 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.expatreader import create_parser
  from xml.sax.xmlreader import InputSource, AttributesImpl, AttributesNSImpl
--- 9,14 ----
      # 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, unescape, quoteattr, \
!                              XMLFilterBase
  from xml.sax.expatreader import create_parser
  from xml.sax.xmlreader import InputSource, AttributesImpl, AttributesNSImpl
***************
*** 70,73 ****
--- 71,85 ----
  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("&lt;Donald Duck &amp; Co&gt;") == "<Donald Duck & Co>"
+ 
+ def test_unescape_extra():
+     return unescape("Hei på deg", {"å" : "&aring;"}) == "Hei p&aring; deg"
  
  # ===== quoteattr