summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_sax.py
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2002-10-28 17:58:48 (GMT)
committerFred Drake <fdrake@acm.org>2002-10-28 17:58:48 (GMT)
commit32f3add26737afdbca6eda2edc3d27e6d315fc8e (patch)
tree7fd6b1aa78e4db1c39c5a2d4cb4c20e99a113317 /Lib/test/test_sax.py
parent407fea5197cc684a4941d3b47b018c1a80314223 (diff)
downloadcpython-32f3add26737afdbca6eda2edc3d27e6d315fc8e.zip
cpython-32f3add26737afdbca6eda2edc3d27e6d315fc8e.tar.gz
cpython-32f3add26737afdbca6eda2edc3d27e6d315fc8e.tar.bz2
Add a test of interaction between &amp; and extra replacements.
Remove extra noise from the output when there are no errors, and say more in the exception when there are errors.
Diffstat (limited to 'Lib/test/test_sax.py')
-rw-r--r--Lib/test/test_sax.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/Lib/test/test_sax.py b/Lib/test/test_sax.py
index 3c5b11a..af97888 100644
--- a/Lib/test/test_sax.py
+++ b/Lib/test/test_sax.py
@@ -19,17 +19,17 @@ import os
# ===== Utilities
tests = 0
-fails = 0
+failures = []
def confirm(outcome, name):
- global tests, fails
+ global tests
tests = tests + 1
if outcome:
- print "Passed", name
+ if verbose:
+ print "Failed", name
else:
- print "Failed", name
- fails = fails + 1
+ failures.append(name)
def test_make_parser2():
try:
@@ -82,6 +82,9 @@ def test_unescape_all():
def test_unescape_extra():
return unescape("Hei på deg", {"å" : "&aring;"}) == "Hei p&aring; deg"
+def test_unescape_amp_extra():
+ return unescape("&amp;foo;", {"&foo;": "splat"}) == "&foo;"
+
# ===== quoteattr
def test_quoteattr_basic():
@@ -650,6 +653,8 @@ for (name, value) in items:
if name[ : 5] == "test_":
confirm(value(), name)
-print "%d tests, %d failures" % (tests, fails)
-if fails != 0:
- raise TestFailed, "%d of %d tests failed" % (fails, tests)
+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)))