summaryrefslogtreecommitdiff
path: root/tests/test_lxml.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonard.richardson@canonical.com>2011-02-20 08:41:38 -0500
committerLeonard Richardson <leonard.richardson@canonical.com>2011-02-20 08:41:38 -0500
commitec444785a35722778ad188a66fef483cc93d7bbb (patch)
tree041b3f3dbf0f069dbb83da09c52a5fab56df34b2 /tests/test_lxml.py
parenta16883da6445710fcf69cfcc1842fb6883495b1c (diff)
Added an empty-element tag test.
Diffstat (limited to 'tests/test_lxml.py')
-rw-r--r--tests/test_lxml.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/test_lxml.py b/tests/test_lxml.py
index 602fe05..77dd1f1 100644
--- a/tests/test_lxml.py
+++ b/tests/test_lxml.py
@@ -33,14 +33,19 @@ class TestLXMLBuilder(SoupTest):
"<a><B><Cd><EFG></efg></CD></b></A>",
"<a><b><cd><efg></efg></cd></b></a>")
- def test_self_closing(self):
- # HTML's self-closing tags are recognized as such.
+ def test_empty_element(self):
+ # HTML's empty-element tags are recognized as such.
self.assertSoupEquals(
"<p>A <meta> tag</p>", "<p>A <meta /> tag</p>")
self.assertSoupEquals(
"<p>Foo<br/>bar</p>", "<p>Foo<br />bar</p>")
+ def test_empty_tag_thats_not_an_empty_element_tag(self):
+ # A tag that is empty but not an HTML empty-element tag
+ # is not presented as an empty-element tag.
+ self.assertSoupEquals("<p>", "<p></p>")
+
def test_comment(self):
# Comments are represented as Comment objects.
markup = "<p>foo<!--foobar-->baz</p>"
@@ -351,6 +356,9 @@ class TestLXMLBuilderInvalidMarkup(SoupTest):
'<table><tr><table><tr id="nested">',
'<table><tr><table><tr id="nested"></tr></table></tr></table>')
+ def test_empty_element_tag_with_contents(self):
+ self.assertSoupEquals("<br>foo</br>", "<br />foo")
+
def test_doctype_in_body(self):
markup = "<p>one<!DOCTYPE foobar>two</p>"
self.assertSoupEquals(markup)