diff options
author | Fred Drake <fdrake@acm.org> | 2002-10-28 17:58:48 +0000 |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2002-10-28 17:58:48 +0000 |
commit | 32f3add26737afdbca6eda2edc3d27e6d315fc8e (patch) | |
tree | 7fd6b1aa78e4db1c39c5a2d4cb4c20e99a113317 /Lib/test/test_sax.py | |
parent | Really do replacement of & last to avoid bad interactions between & (diff) | |
download | cpython-32f3add26737afdbca6eda2edc3d27e6d315fc8e.tar.gz cpython-32f3add26737afdbca6eda2edc3d27e6d315fc8e.tar.bz2 cpython-32f3add26737afdbca6eda2edc3d27e6d315fc8e.zip |
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.
Diffstat (limited to 'Lib/test/test_sax.py')
-rw-r--r-- | Lib/test/test_sax.py | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/Lib/test/test_sax.py b/Lib/test/test_sax.py index 3c5b11ab265..af97888793c 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", {"�" : "å"}) == "Hei på deg" +def test_unescape_amp_extra(): + return unescape("&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))) |