[Python-checkins] CVS: python/dist/src/Lib/test test_sax.py,1.16,1.17

Fred L. Drake fdrake@users.sourceforge.net
Thu, 19 Jul 2001 09:10:17 -0700


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

Modified Files:
	test_sax.py 
Log Message:

Added function xml.sax.saxutils.quoteattr().

This closes SF bug #440351.  It should not be moved to Python 2.1.1.


Index: test_sax.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sax.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -r1.16 -r1.17
*** test_sax.py	2001/01/18 02:22:22	1.16
--- test_sax.py	2001/07/19 16:10:15	1.17
***************
*** 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, XMLFilterBase
  from xml.sax.expatreader import create_parser
  from xml.sax.xmlreader import InputSource, AttributesImpl, AttributesNSImpl
--- 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
***************
*** 69,72 ****
--- 69,91 ----
  def test_escape_extra():
      return escape("Hei på deg", {"å" : "å"}) == "Hei på deg"
+ 
+ # ===== quoteattr
+ 
+ def test_quoteattr_basic():
+     return quoteattr("Donald Duck & Co") == '"Donald Duck & Co"'
+ 
+ def test_single_quoteattr():
+     return (quoteattr('Includes "double" quotes')
+             == '\'Includes "double" quotes\'')
+ 
+ def test_double_quoteattr():
+     return (quoteattr("Includes 'single' quotes")
+             == "\"Includes 'single' quotes\"")
+ 
+ def test_single_double_quoteattr():
+     return (quoteattr("Includes 'single' and \"double\" quotes")
+             == "\"Includes 'single' and "double" quotes\"")
+ 
+ # ===== make_parser
  
  def test_make_parser():