From ab7ed77ab3560f6d574d577befc7a1f593e45327 Mon Sep 17 00:00:00 2001 From: Leonard Richardson Date: Mon, 20 Feb 2012 11:43:46 -0500 Subject: Changd the class structure so that the default parser test class uses html.parser. --- bs4/tests/test_tree.py | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'bs4/tests/test_tree.py') 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
and

tag are empty-element, just because - # they have no contents. - self.assertEqual(b"
", xml_br.encode()) - self.assertEqual(b"

", xml_p.encode()) + # Both the
and

tag are empty-element, just because + # they have no contents. + self.assertEqual(b"
", xml_br.encode()) + self.assertEqual(b"

", xml_p.encode()) html_soup = BeautifulSoup("", "html") html_br = html_soup.new_tag("br") @@ -1000,10 +1007,6 @@ class TestElementObjects(SoupTest): markup = '' self.assertSoupEquals(markup, '') - def test_multiple_values_for_the_same_attribute_are_collapsed(self): - markup = '' - self.assertSoupEquals(markup, '') - def test_string(self): # A tag that contains only a text node makes that node # available as .string. -- cgit v1.2.3