diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2004-05-02 20:37:13 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2004-05-02 20:37:13 (GMT) |
commit | 9f1340b9f231f920fcf70ce2f8ea0c0e3a322dd9 (patch) | |
tree | ceaa9e3720453edc03e9a8414b304e3f0ef7b6b7 /Lib/test/test_xmllib.py | |
parent | d7911a33173fa4a51428b90e42dc1a0cff2cf5f4 (diff) | |
download | cpython-9f1340b9f231f920fcf70ce2f8ea0c0e3a322dd9.zip cpython-9f1340b9f231f920fcf70ce2f8ea0c0e3a322dd9.tar.gz cpython-9f1340b9f231f920fcf70ce2f8ea0c0e3a322dd9.tar.bz2 |
Do not use the default namespace for attributes.
Fixes http://bugs.debian.org/229885
Will backport to 2.3.
Diffstat (limited to 'Lib/test/test_xmllib.py')
-rw-r--r-- | Lib/test/test_xmllib.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_xmllib.py b/Lib/test/test_xmllib.py index b14ead9..0780bc9 100644 --- a/Lib/test/test_xmllib.py +++ b/Lib/test/test_xmllib.py @@ -13,6 +13,8 @@ testdoc = """\ <greeting>Hello, world!</greeting> """ +nsdoc = "<foo xmlns='URI' attr='val'/>" + import warnings warnings.filterwarnings("ignore", ".* xmllib .* obsolete.*", DeprecationWarning, r'xmllib$') @@ -29,6 +31,18 @@ class XMLParserTestCase(unittest.TestCase): parser.feed(c) parser.close() + def test_default_namespace(self): + class H(xmllib.XMLParser): + def unknown_starttag(self, name, attr): + self.name, self.attr = name, attr + h=H() + h.feed(nsdoc) + h.close() + # The default namespace applies to elements... + self.assertEquals(h.name, "URI foo") + # but not to attributes + self.assertEquals(h.attr, {'attr':'val'}) + def test_main(): test_support.run_unittest(XMLParserTestCase) |