summaryrefslogtreecommitdiff
path: root/bs4/tests/test_tree.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonard.richardson@canonical.com>2012-02-20 11:43:46 -0500
committerLeonard Richardson <leonard.richardson@canonical.com>2012-02-20 11:43:46 -0500
commitab7ed77ab3560f6d574d577befc7a1f593e45327 (patch)
tree5f6427c8057bcf28ac6a1f9ff3fec92ed9056cb2 /bs4/tests/test_tree.py
parent0a53ebe4c61ecf78b19fd5a5fe0ae2a66654dd18 (diff)
Changd the class structure so that the default parser test class uses html.parser.
Diffstat (limited to 'bs4/tests/test_tree.py')
-rw-r--r--bs4/tests/test_tree.py27
1 files changed, 15 insertions, 12 deletions
diff --git a/bs4/tests/test_tree.py b/bs4/tests/test_tree.py
index 70a7da1..5d5ca9a 100644
--- a/bs4/tests/test_tree.py
+++ b/bs4/tests/test_tree.py
@@ -16,7 +16,13 @@ import warnings
from bs4 import BeautifulSoup
from bs4.builder import builder_registry
from bs4.element import CData, NavigableString, SoupStrainer, Tag
-from bs4.testing import SoupTest
+from bs4.testing import (
+ SoupTest,
+ skipIf,
+)
+
+XML_BUILDER_PRESENT = (builder_registry.lookup("xml") is not None)
+
class TreeTest(SoupTest):
@@ -600,14 +606,15 @@ class TestTagCreation(SoupTest):
self.assertEqual(None, new_tag.parent)
def test_tag_inherits_self_closing_rules_from_builder(self):
- xml_soup = BeautifulSoup("", "xml")
- xml_br = xml_soup.new_tag("br")
- xml_p = xml_soup.new_tag("p")
+ if XML_BUILDER_PRESENT:
+ xml_soup = BeautifulSoup("", "xml")
+ xml_br = xml_soup.new_tag("br")
+ xml_p = xml_soup.new_tag("p")
- # Both the <br> and <p> tag are empty-element, just because
- # they have no contents.
- self.assertEqual(b"<br/>", xml_br.encode())
- self.assertEqual(b"<p/>", xml_p.encode())
+ # Both the <br> and <p> tag are empty-element, just because
+ # they have no contents.
+ self.assertEqual(b"<br/>", xml_br.encode())
+ self.assertEqual(b"<p/>", xml_p.encode())
html_soup = BeautifulSoup("", "html")
html_br = html_soup.new_tag("br")
@@ -1000,10 +1007,6 @@ class TestElementObjects(SoupTest):
markup = '<b a="1" z="5" m="3" f="2" y="4"></b>'
self.assertSoupEquals(markup, '<b a="1" f="2" m="3" y="4" z="5"></b>')
- def test_multiple_values_for_the_same_attribute_are_collapsed(self):
- markup = '<b b="20" a="1" b="10" a="2" a="3" a="4"></b>'
- self.assertSoupEquals(markup, '<b a="1" b="20"></b>')
-
def test_string(self):
# A tag that contains only a text node makes that node
# available as .string.