summaryrefslogtreecommitdiff
path: root/bs4/testing.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonard.richardson@canonical.com>2012-02-23 13:35:53 -0500
committerLeonard Richardson <leonard.richardson@canonical.com>2012-02-23 13:35:53 -0500
commit951d355581d27c2f3b61fa582fbe6ae57b46afb4 (patch)
tree26914054ffcb4ecc091d1e1b5f87bf4f2486ad86 /bs4/testing.py
parentfcefebe15290b9ff44934efa73fb07c70ebf5171 (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.py23
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):