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

fdrake@users.sourceforge.net fdrake@users.sourceforge.net
Mon, 28 Oct 2002 09:58:50 -0800


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

Modified Files:
	test_sax.py 
Log Message:
Add a test of interaction between & and extra replacements.
Remove extra noise from the output when there are no errors, and say more
in the exception when there are errors.


Index: test_sax.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sax.py,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** test_sax.py	26 Oct 2002 14:50:45 -0000	1.23
--- test_sax.py	28 Oct 2002 17:58:48 -0000	1.24
***************
*** 20,34 ****
  
  tests = 0
! fails = 0
  
  def confirm(outcome, name):
!     global tests, fails
  
      tests = tests + 1
      if outcome:
!         print "Passed", name
      else:
!         print "Failed", name
!         fails = fails + 1
  
  def test_make_parser2():
--- 20,34 ----
  
  tests = 0
! failures = []
  
  def confirm(outcome, name):
!     global tests
  
      tests = tests + 1
      if outcome:
!         if verbose:
!             print "Failed", name
      else:
!         failures.append(name)
  
  def test_make_parser2():
***************
*** 83,86 ****
--- 83,89 ----
      return unescape("Hei på deg", {"å" : "å"}) == "Hei på deg"
  
+ def test_unescape_amp_extra():
+     return unescape("&foo;", {"&foo;": "splat"}) == "&foo;"
+ 
  # ===== quoteattr
  
***************
*** 651,655 ****
          confirm(value(), name)
  
! print "%d tests, %d failures" % (tests, fails)
! if fails != 0:
!     raise TestFailed, "%d of %d tests failed" % (fails, tests)
--- 654,660 ----
          confirm(value(), name)
  
! if verbose:
!     print "%d tests, %d failures" % (tests, len(failures))
! if failures:
!     raise TestFailed("%d of %d tests failed: %s"
!                      % (len(failures), tests, ", ".join(failures)))