diff options
author | Leonard Richardson <leonard.richardson@canonical.com> | 2012-02-23 13:35:53 -0500 |
---|---|---|
committer | Leonard Richardson <leonard.richardson@canonical.com> | 2012-02-23 13:35:53 -0500 |
commit | 951d355581d27c2f3b61fa582fbe6ae57b46afb4 (patch) | |
tree | 26914054ffcb4ecc091d1e1b5f87bf4f2486ad86 /bs4/testing.py | |
parent | fcefebe15290b9ff44934efa73fb07c70ebf5171 (diff) |
Test that HTML5 parsers add the appropriate namespace to the tags they parse.
Diffstat (limited to 'bs4/testing.py')
-rw-r--r-- | bs4/testing.py | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/bs4/testing.py b/bs4/testing.py index 6f9d857..55b953f 100644 --- a/bs4/testing.py +++ b/bs4/testing.py @@ -391,10 +391,29 @@ class XMLTreeBuilderSmokeTest(object): markup = '<root xmlns:a="http://example.com/" xmlns:b="http://example.net/"><a:foo>This tag is in the a namespace</a:foo><b:foo>This tag is in the b namespace</b:foo></root>' soup = self.soup(markup) root = soup.root - self.assertEquals("http://example.com/", root['xmlns:a']) - self.assertEquals("http://example.net/", root['xmlns:b']) + self.assertEqual("http://example.com/", root['xmlns:a']) + self.assertEqual("http://example.net/", root['xmlns:b']) +class HTML5TreeBuilderSmokeTest(HTMLTreeBuilderSmokeTest): + """Smoke test for a tree builder that supports HTML5.""" + + def test_html_tags_have_namespace(self): + markup = "<a>" + soup = self.soup(markup) + self.assertEqual("http://www.w3.org/1999/xhtml", soup.a.namespace) + + def test_svg_tags_have_namespace(self): + markup = '<svg>' + soup = self.soup(markup) + self.assertEqual("http://www.w3.org/2000/svg", soup.svg.namespace) + + def test_mathml_tags_have_namespace(self): + markup = '<math>' + soup = self.soup(markup) + self.assertEqual( + 'http://www.w3.org/1998/Math/MathML', soup.math.namespace) + def skipIf(condition, reason): def nothing(test, *args, **kwargs): |